Diff
Modified: trunk/ChangeLog (246075 => 246076)
--- trunk/ChangeLog 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/ChangeLog 2019-06-04 19:15:21 UTC (rev 246076)
@@ -1,3 +1,12 @@
+2019-06-04 Takashi Komori <[email protected]>
+
+ [WinCairo] Implement cpu and memory measuring functions.
+ https://bugs.webkit.org/show_bug.cgi?id=198466
+
+ Reviewed by Don Olmstead.
+
+ * Source/cmake/OptionsWin.cmake:
+
2019-06-03 Zan Dobersek <[email protected]>
[Nicosia] Disable async scrolling until implemented
Modified: trunk/LayoutTests/ChangeLog (246075 => 246076)
--- trunk/LayoutTests/ChangeLog 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/LayoutTests/ChangeLog 2019-06-04 19:15:21 UTC (rev 246076)
@@ -1,3 +1,12 @@
+2019-06-04 Takashi Komori <[email protected]>
+
+ [WinCairo] Implement cpu and memory measuring functions.
+ https://bugs.webkit.org/show_bug.cgi?id=198466
+
+ Reviewed by Don Olmstead.
+
+ * platform/wincairo/TestExpectations:
+
2019-06-02 Antoine Quint <[email protected]>
[Pointer Events] Expose navigator.maxTouchPoints
Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (246075 => 246076)
--- trunk/LayoutTests/platform/wincairo/TestExpectations 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations 2019-06-04 19:15:21 UTC (rev 246076)
@@ -1564,6 +1564,9 @@
imported/mozilla [ Skip ]
imported/w3c [ Skip ]
inspector [ Skip ]
+inspector/memory/ [ Pass ]
+inspector/cpu-profiler/ [ Pass ]
+inspector/cpu-profiler/threads.html [ Failure ]
js/dom/deep-recursion-test.html [ Failure ]
js/dom/dom-static-property-for-in-iteration.html [ Failure ]
js/dom/regress-157246.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (246075 => 246076)
--- trunk/Source/WebCore/ChangeLog 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Source/WebCore/ChangeLog 2019-06-04 19:15:21 UTC (rev 246076)
@@ -1,3 +1,27 @@
+2019-06-04 Takashi Komori <[email protected]>
+
+ [WinCairo] Implement cpu and memory measuring functions.
+ https://bugs.webkit.org/show_bug.cgi?id=198466
+
+ Reviewed by Don Olmstead.
+
+ Tests: inspector/memory/tracking.html
+ inspector/cpu-profiler/tracking.html
+
+ * PlatformWinCairo.cmake:
+ * page/ResourceUsageThread.h:
+ * page/win/ResourceUsageOverlayWin.cpp: Copied from Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp.
+ (WebCore::ResourceUsageOverlay::platformInitialize):
+ (WebCore::ResourceUsageOverlay::platformDestroy):
+ * page/win/ResourceUsageThreadWin.cpp: Added.
+ (WebCore::ResourceUsageThread::platformSaveStateBeforeStarting):
+ (WebCore::fileTimeToUint64):
+ (WebCore::getCurrentCpuTime):
+ (WebCore::cpuUsage):
+ (WebCore::memoryUsage):
+ (WebCore::ResourceUsageThread::platformCollectCPUData):
+ (WebCore::ResourceUsageThread::platformCollectMemoryData):
+
2019-06-04 Antoine Quint <[email protected]>
[Pointer Events] Only allow pointer capture if the pointer is in the active buttons state
Modified: trunk/Source/WebCore/PlatformWinCairo.cmake (246075 => 246076)
--- trunk/Source/WebCore/PlatformWinCairo.cmake 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Source/WebCore/PlatformWinCairo.cmake 2019-06-04 19:15:21 UTC (rev 246076)
@@ -12,6 +12,8 @@
list(APPEND WebCore_SOURCES
page/win/FrameCairoWin.cpp
+ page/win/ResourceUsageOverlayWin.cpp
+ page/win/ResourceUsageThreadWin.cpp
platform/graphics/GLContext.cpp
platform/graphics/PlatformDisplay.cpp
Modified: trunk/Source/WebCore/page/ResourceUsageThread.h (246075 => 246076)
--- trunk/Source/WebCore/page/ResourceUsageThread.h 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Source/WebCore/page/ResourceUsageThread.h 2019-06-04 19:15:21 UTC (rev 246076)
@@ -72,7 +72,7 @@
void recomputeCollectionMode();
void createThreadIfNeeded();
- void threadBody();
+ NO_RETURN void threadBody();
void platformSaveStateBeforeStarting();
void platformCollectCPUData(JSC::VM*, ResourceUsageData&);
Copied: trunk/Source/WebCore/page/win/ResourceUsageOverlayWin.cpp (from rev 246075, trunk/Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp) (0 => 246076)
--- trunk/Source/WebCore/page/win/ResourceUsageOverlayWin.cpp (rev 0)
+++ trunk/Source/WebCore/page/win/ResourceUsageOverlayWin.cpp 2019-06-04 19:15:21 UTC (rev 246076)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceUsageOverlay.h"
+
+#if ENABLE(RESOURCE_USAGE)
+
+namespace WebCore {
+
+void ResourceUsageOverlay::platformInitialize()
+{
+}
+
+void ResourceUsageOverlay::platformDestroy()
+{
+}
+
+}
+
+#endif
Added: trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp (0 => 246076)
--- trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp (rev 0)
+++ trunk/Source/WebCore/page/win/ResourceUsageThreadWin.cpp 2019-06-04 19:15:21 UTC (rev 246076)
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2019 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ResourceUsageThread.h"
+
+#if ENABLE(RESOURCE_USAGE)
+
+#include <_javascript_Core/GCActivityCallback.h>
+#include <_javascript_Core/VM.h>
+#include <psapi.h>
+
+namespace WebCore {
+
+void ResourceUsageThread::platformSaveStateBeforeStarting()
+{
+}
+
+static uint64_t fileTimeToUint64(FILETIME ft)
+{
+ ULARGE_INTEGER u;
+ u.LowPart = ft.dwLowDateTime;
+ u.HighPart = ft.dwHighDateTime;
+
+ return u.QuadPart;
+}
+
+static bool getCurrentCpuTime(uint64_t& nowTime, uint64_t& userTime, uint64_t& kernelTime)
+{
+ FILETIME creationFileTime, exitFileTime, kernelFileTime, userFileTime;
+ if (!GetProcessTimes(GetCurrentProcess(), &creationFileTime, &exitFileTime, &kernelFileTime, &userFileTime))
+ return false;
+
+ FILETIME nowFileTime;
+ GetSystemTimeAsFileTime(&nowFileTime);
+
+ nowTime = fileTimeToUint64(nowFileTime);
+ userTime = fileTimeToUint64(userFileTime);
+ kernelTime = fileTimeToUint64(kernelFileTime);
+
+ return true;
+}
+
+static float cpuUsage()
+{
+ static int numberOfProcessors = 0;
+ static uint64_t lastTime = 0;
+ static uint64_t lastKernelTime = 0;
+ static uint64_t lastUserTime = 0;
+
+ if (!lastTime) {
+ SYSTEM_INFO systemInfo;
+ GetSystemInfo(&systemInfo);
+ numberOfProcessors = systemInfo.dwNumberOfProcessors;
+
+ getCurrentCpuTime(lastTime, lastKernelTime, lastUserTime);
+ return 0;
+ }
+
+ uint64_t nowTime, kernelTime, userTime;
+ if (!getCurrentCpuTime(nowTime, kernelTime, userTime))
+ return 0;
+
+ uint64_t elapsed = nowTime - lastTime;
+ uint64_t totalCPUTime = (kernelTime - lastKernelTime);
+ totalCPUTime += (userTime - lastUserTime);
+
+ lastTime = nowTime;
+ lastKernelTime = kernelTime;
+ lastUserTime = userTime;
+
+ float usage = (100.0 * totalCPUTime) / elapsed / numberOfProcessors;
+ return clampTo<float>(usage, 0, 100);
+}
+
+static size_t memoryUsage()
+{
+ PROCESS_MEMORY_COUNTERS_EX pmc;
+ if (GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc)))
+ return pmc.PrivateUsage;
+
+ return 0;
+}
+
+void ResourceUsageThread::platformCollectCPUData(JSC::VM*, ResourceUsageData& data)
+{
+ data.cpu = cpuUsage();
+
+ // FIXME: Exclude the ResourceUsage thread.
+ // FIXME: Exclude the SamplingProfiler thread.
+ // FIXME: Classify usage per thread.
+ data.cpuExcludingDebuggerThreads = data.cpu;
+}
+
+void ResourceUsageThread::platformCollectMemoryData(JSC::VM* vm, ResourceUsageData& data)
+{
+ data.totalDirtySize = memoryUsage();
+
+ size_t currentGCHeapCapacity = vm->heap.blockBytesAllocated();
+ size_t currentGCOwnedExtra = vm->heap.extraMemorySize();
+ size_t currentGCOwnedExternal = vm->heap.externalMemorySize();
+ RELEASE_ASSERT(currentGCOwnedExternal <= currentGCOwnedExtra);
+
+ data.categories[MemoryCategory::GCHeap].dirtySize = currentGCHeapCapacity;
+ data.categories[MemoryCategory::GCOwned].dirtySize = currentGCOwnedExtra - currentGCOwnedExternal;
+ data.categories[MemoryCategory::GCOwned].externalSize = currentGCOwnedExternal;
+
+ data.totalExternalSize = currentGCOwnedExternal;
+
+ data.timeOfNextEdenCollection = data.timestamp + vm->heap.edenActivityCallback()->timeUntilFire().valueOr(Seconds(std::numeric_limits<double>::infinity()));
+ data.timeOfNextFullCollection = data.timestamp + vm->heap.fullActivityCallback()->timeUntilFire().valueOr(Seconds(std::numeric_limits<double>::infinity()));
+}
+
+}
+
+#endif
Modified: trunk/Source/cmake/OptionsWin.cmake (246075 => 246076)
--- trunk/Source/cmake/OptionsWin.cmake 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Source/cmake/OptionsWin.cmake 2019-06-04 19:15:21 UTC (rev 246076)
@@ -90,6 +90,7 @@
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_LOAD_STATISTICS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
Modified: trunk/Tools/ChangeLog (246075 => 246076)
--- trunk/Tools/ChangeLog 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Tools/ChangeLog 2019-06-04 19:15:21 UTC (rev 246076)
@@ -1,3 +1,13 @@
+2019-06-04 Takashi Komori <[email protected]>
+
+ [WinCairo] Implement cpu and memory measuring functions.
+ https://bugs.webkit.org/show_bug.cgi?id=198466
+
+ Reviewed by Don Olmstead.
+
+ * WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp:
+ (WTR::TestRunner::inspectorTestStubURL):
+
2019-06-04 Zan Dobersek <[email protected]>
[misc] Remove JSCOnly ARMv7 Traditional bot
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp (246075 => 246076)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp 2019-06-04 19:06:32 UTC (rev 246075)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/win/TestRunnerWin.cpp 2019-06-04 19:15:21 UTC (rev 246076)
@@ -27,6 +27,8 @@
#include "TestRunner.h"
#include "ActivateFonts.h"
+#include <shlwapi.h>
+#include <wininet.h>
namespace WTR {
@@ -37,7 +39,25 @@
JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
{
- return JSStringCreateWithUTF8CString("");
+ wchar_t exePath[MAX_PATH];
+ if (::GetModuleFileName(nullptr, exePath, MAX_PATH)) {
+ wchar_t drive[_MAX_DRIVE];
+ wchar_t dir[_MAX_DIR];
+ _wsplitpath(exePath, drive, dir, nullptr, nullptr);
+
+ wchar_t stubPath[MAX_PATH];
+ wcsncpy(stubPath, drive, MAX_PATH);
+ wcsncat(stubPath, dir, MAX_PATH - wcslen(stubPath));
+ wcsncat(stubPath, L"\\WebKit.resources\\WebInspectorUI\\TestStub.html", MAX_PATH - wcslen(stubPath));
+
+ wchar_t fileURI[INTERNET_MAX_PATH_LENGTH];
+ DWORD fileURILength = INTERNET_MAX_PATH_LENGTH;
+ UrlCreateFromPathW(stubPath, fileURI, &fileURILength, 0);
+
+ return JSStringCreateWithCharacters(fileURI, fileURILength);
+ }
+
+ return nullptr;
}
void TestRunner::platformInitialize()