Unreviewed build fix after r174456.

I was comparing a signed int to an unsigned one.

* platform/graphics/mac/FontCacheMac.mm:
(WebCore::shouldAutoActivateFontIfNeeded):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r174403): media/track/track-forced-subtitles-in-band.html fails
https://bugs.webkit.org/show_bug.cgi?id=137525

* TestExpectations: Marked media/track/track-forced-subtitles-in-band.html as an expected failure.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Perf dashboard should store commit logs
https://bugs.webkit.org/show_bug.cgi?id=137510

Reviewed by Darin Adler.

For the v2 version of the perf dashboard, we would like to be able to see commit logs in the dashboard itself.

This patch replaces "build_revisions" table with "commits" and "build_commits" relations to store commit logs,
and add JSON APIs to report and retrieve them. It also adds a tools/pull-svn.py to pull commit logs from
a subversion directory. The git version of this script will be added in a follow up patch.

In the new database schema, each revision in each repository is represented by exactly one row in "commits"
instead of one row for each build in "build_revisions". "commits" and "builds" now have a proper many-to-many
relationship via "build_commits" relations.

In order to migrate an existing instance of this application, run the following SQL commands:

BEGIN;

INSERT INTO commits (commit_repository, commit_revision, commit_time)
    (SELECT DISTINCT ON (revision_repository, revision_value)
        revision_repository, revision_value, revision_time FROM build_revisions);

INSERT INTO build_commits (commit_build, build_commit) SELECT revision_build, commit_id
    FROM commits, build_revisions
    WHERE commit_repository = revision_repository AND commit_revision = revision_value;

DROP TABLE build_revisions;

COMMIT;

The helper script to submit commit logs can be used as follows:

python ./tools/pull-svn.py "WebKit" https://svn.webkit.org/repository/webkit/ https://perf.webkit.org
    feeder-slave feeder-slave-password 60 "webkit-patch find-users"

The above command will pull the subversion server at https://svn.webkit.org/repository/webkit/ every 60 seconds
to retrieve at most 10 commits, and submits the results to https://perf.webkit.org using "feeder-slave" and
"feeder-slave-password" as the builder name and the builder password respectively.

The last, optional, argument is the shell command to convert a subversion account to the corresponding username.
e.g. "webkit-patch find-users rniwa@webkit.org" yields "Ryosuke Niwa" <rniwa@webkit.org> in the stdout.

* init-database.sql: Replaced "build_revisions" relation with "commits" and "build_commits" relations.

* public/api/commits.php: Added. Retrieves a list of commits based on arguments in its path of the form
    /api/commits/<repository-name>/<filter>. The behavior of this API depends on <filter> as follows:

    - Not specified - It returns every single commit for a given repository.
    - Matches "oldest" - It returns the commit with the oldest timestamp.
    - Matches "latest" - It returns the commit with the latest timestamp.
    - Matches "last-reported" - It returns the commit with the latest timestamp added via report-commits.php.
    - Is entirely alphanumeric - It returns the commit whose revision matches the filter.
    - Is of the form <alphanumeric>:<alphanumeric> or <alphanumeric>-<alphanumeric> - It retrieves the list
    of commits added via report-commits.php between two timestamps retrieved from commits whose revisions
    match the two alphanumeric values specified. Because it retrieves commits based on their timestamps,
    the list may contain commits that do not appear as neither hash's ancestor in git/mercurial.
(main):
(commit_from_revision):
(fetch_commits_between):
(format_commits):

* public/api/report-commits.php: Added. A JSON API to report new subversion, git, or mercurial commits.
See tests/api-report-commits.js for examples on how to use this API.

* public/api/runs.php: Updated the query to use "commit_builds" and "commits" relations instead of
"build_revisions". Regrettably, the new query is 20% slower but I'm going to wait until the new UI is ready
to optimize this and other JSON APIs.

* public/include/db.php:
(Database::select_or_insert_row):
(Database::update_or_insert_row): Added.
(Database::_select_update_or_insert_row): Extracted from select_or_insert_row. Try to update first and then
insert if the update fails for update_or_insert_row. Preserves the old behavior when $should_update is false.

(Database::select_first_row):
(Database::select_last_row): Added.
(Database::select_first_or_last_row): Extracted from select_first_row. Fixed a bug that we were asserting
$order_by to be not alphanumeric/underscore. Retrieve the last row instead of the first if $descending_order.

* public/include/report-processor.php:
(ReportProcessor::resolve_build_id): Store commits instead of build_revisions. We don't worry about the race
condition for adding "build_commits" rows since we shouldn't have a single tester submitting the same result
concurrently. Even if it happened, it will only result in a PHP error and the database will stay consistent.

* run-tests.js:
(pathToTests): Don't call path.resolve with "undefined" testName; It throws an exception in the latest node.js.

* tests/api-report-commits.js: Added.
* tests/api-report.js: Fixed a test per build_revisions to build_commits/commits replacement.

* tools: Added.
* tools/pull-svn.py: Added. See above for how to use this script.
(main):
(determine_first_revision_to_fetch):
(fetch_revision_from_dasbhoard):
(fetch_commit_and_resolve_author):
(fetch_commit):
(textContent):
(resolve_author_name_from_email):
(submit_commits):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[EME][Mac] Update CDMSessionMediaSourceAVFObjC to match new API provided by AVStreamSession
https://bugs.webkit.org/show_bug.cgi?id=137469

Reviewed by Brent Fulgham.

Update our forward declaration to match the API provided by AVStreamSession.
AVStreamSession now takes an error: parameter in its initialiazer. It also provides the
sessionIdentifier used by the CDM, which CDMSessionMediaSourceAVFObjC will use as the
value of sessionId. Having this identifier allows us to fire a
secure-proof-of-key-release message after the client calls MediaKeySession.close().
Because this call will now generate messages, which have to be responded to in order
to remove those proofs from storage, do not clear the CDMSession from MediaKeySession
after calling close().

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::~MediaKeySession):
(WebCore::MediaKeySession::close):
(WebCore::MediaKeySession::setError): Deleted.
(WebCore::MediaKeySession::sessionId): Deleted.
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
(WebCore::CDMSessionMediaSourceAVFObjC::setSessionId):
* platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
(-[CDMSessionMediaSourceAVFObjCListener initWithParent:]):
(-[CDMSessionMediaSourceAVFObjCObserver dealloc]):
(-[CDMSessionMediaSourceAVFObjCObserver beginObserving:]):
(-[CDMSessionMediaSourceAVFObjCObserver stopObserving:]):
(-[CDMSessionMediaSourceAVFObjCObserver invalidate]):
(-[CDMSessionMediaSourceAVFObjCListener observeValueForKeyPath:ofObject:change:context:]):
(WebCore::CDMSessionMediaSourceAVFObjC::CDMSessionMediaSourceAVFObjC):
(WebCore::CDMSessionMediaSourceAVFObjC::~CDMSessionMediaSourceAVFObjC):
(WebCore::CDMSessionMediaSourceAVFObjC::releaseKeys):
(WebCore::CDMSessionMediaSourceAVFObjC::update):
(WebCore::CDMSessionMediaSourceAVFObjC::addSourceBuffer):
(WebCore::CDMSessionMediaSourceAVFObjC::removeSourceBuffer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[webkitpy] Use python-irclib-0.4.8.tar.gz instead of zip in AutoInstaller
https://bugs.webkit.org/show_bug.cgi?id=137516

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/thirdparty/__init__.py:
(AutoinstallImportHook._install_irc):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Resolve warnings about missing __has_include macro under MSVC
https://bugs.webkit.org/show_bug.cgi?id=137524

Reviewed by Anders Carlsson.

* wtf/Compiler.h: Provide a dummy implementation of __has_include that
avoids the warning without changing compile behavior.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2:
Implement WKPageIsPlayingAudio().
https://bugs.webkit.org/show_bug.cgi?id=137048

Reviewed by Darin Adler.

* UIProcess/API/C/WKPage.cpp:
(WKPageIsPlayingAudio):

Tools:
Add a test for WKPageIsPlayingAudio().
https://bugs.webkit.org/show_bug.cgi?id=137048

Reviewed by Darin Adler.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add file-with-video.html, test.mp4, and WKPageIsPlayingAudio.cpp to the project.
* TestWebKitAPI/Tests/WebKit2/WKPageIsPlayingAudio.cpp: Added.
(TestWebKitAPI::nullJavaScriptCallback):
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::isPlayingAudioDidChangeCallback):
(TestWebKitAPI::setUpClients):
(TestWebKitAPI::TEST):
This test loads a page with a video in it. When the page is loaded, we first check that
WKPageIsPlayingAudio() returns false for the page. Then we call a method to start the video.
When the WKPageUIClient::isPlayingAudioDidChange callback gets called, check that WKPageIsPlayingAudio()
now returns true for the page.
* TestWebKitAPI/Tests/WebKit2/file-with-video.html: Added.
* TestWebKitAPI/Tests/WebKit2/test.mp4: Added.
This is a video copied from LayoutTests/media/content.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove tests that always pass from the TestExpectations files.

* TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Win] Resolve various static analyzer warnings in WebCore.
https://bugs.webkit.org/show_bug.cgi?id=137526

Reviewed by Dean Jackson.

A series of small changes to resolve various issues found by the MSVC static analyzer.

* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::clear): Add assertion that it->value should never be null.
* page/SessionIDHash.h:
(WTF::HashTraits<WebCore::SessionID>::constructDeletedValue): Add explicit cast to avoid
compiler warning.
(WTF::HashTraits<WebCore::SessionID>::isDeletedValue): Ditto.
* page/win/FrameCGWin.cpp:
(WebCore::imageFromRect): Resolve static analyzer warnings by initializing bits, and
checking the return value of ::CreateDIBSection, which return nullptr on error.
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(printLayer): Use correct MSVC format specifier for size_t.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::getLinkedFonts): Handle possibility that a font link key does not exist.
(WebCore::FontCache::systemFallbackForCharacters): Handle error case when a valid code page
does not exist for a given character.
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::SimpleFontData::containsCharacters): Handle error cases for mapping to the CP_ACP code page,
and related failures when attempting to access the contents of a given code page.
* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::itemizeShapeAndPlace): Handle possible failure in the
ScriptItemize API call.
(WebCore::UniscribeController::shapeAndPlaceItem): Ditto for ScriptXtoCP API call.
* platform/win/BString.h: Use consistent SAL annotations for our typedeof of BSTR as in
the system header.
* platform/win/COMPtr.h: Ditto for HRESULT.
* platform/win/DragImageCGWin.cpp:
(WebCore::allocImage): Handle case of failing CreateDIBSection API call.
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::show): Handle case of failing SystemParamtersInfo API call.
(WebCore::PopupMenuWin::wndProc): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174465 268f45cc-cd09-0410-ab3c-d52691b4dbfc