Diff
Modified: trunk/Source/WebKit2/ChangeLog (204317 => 204318)
--- trunk/Source/WebKit2/ChangeLog 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-10 00:49:34 UTC (rev 204318)
@@ -1,3 +1,37 @@
+2016-08-09 Brady Eidson <beid...@apple.com>
+
+ [WK2] Only send gamepad input events to the currently focused page.
+ https://bugs.webkit.org/show_bug.cgi?id=160699
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/Gamepad/UIGamepadProvider.cpp:
+ (WebKit::UIGamepadProvider::updateTimerFired):
+ (WebKit::UIGamepadProvider::platformWebProcessProxyForGamepadInput):
+ * UIProcess/Gamepad/UIGamepadProvider.h:
+ * UIProcess/Gamepad/mac/UIGamepadProviderMac.mm: Copied from Source/WebKit2/UIProcess/API/mac/WKViewInternal.h.
+ (WebKit::UIGamepadProvider::platformWebPageProxyForGamepadInput):
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::gamepadActivity):
+ * UIProcess/WebPageProxy.h:
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::gamepadActivity): Deleted.
+ * UIProcess/WebProcessPool.h:
+
+ * WebKit2.xcodeproj/project.pbxproj:
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::gamepadActivity):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::gamepadActivity): Deleted.
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+
2016-08-09 Anders Carlsson <ander...@apple.com>
Remove code that would tell clients whenever the list of installed plug-ins changes
Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.cpp 2016-08-10 00:49:34 UTC (rev 204318)
@@ -72,10 +72,9 @@
gamepadDatas.uncheckedAppend({ });
}
- // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160699)
- // Only send updates to the process pool that contains the currently focused web page.
- for (auto& pool : m_processPoolsUsingGamepads)
- pool->gamepadActivity(gamepadDatas);
+ auto webPageProxy = platformWebPageProxyForGamepadInput();
+ if (webPageProxy && m_processPoolsUsingGamepads.contains(&webPageProxy->process().processPool()))
+ webPageProxy->gamepadActivity(gamepadDatas);
m_hadActivitySinceLastSynch = false;
}
@@ -185,6 +184,11 @@
// FIXME: Implement for other platforms
}
+WebProcessProxy* UIGamepadProvider::platformWebProcessProxyForGamepadInput()
+{
+ // FIXME: Implement for other platforms
+}
+
#endif // !PLATFORM(MAC)
}
Modified: trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h 2016-08-10 00:49:34 UTC (rev 204318)
@@ -36,6 +36,7 @@
namespace WebKit {
class UIGamepad;
+class WebPageProxy;
class WebProcessPool;
struct GamepadData;
@@ -56,6 +57,7 @@
void platformStartMonitoringGamepads();
void platformStopMonitoringGamepads();
const Vector<WebCore::PlatformGamepad*>& platformGamepads();
+ WebPageProxy* platformWebPageProxyForGamepadInput();
void platformGamepadConnected(WebCore::PlatformGamepad&) final;
void platformGamepadDisconnected(WebCore::PlatformGamepad&) final;
Copied: trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm (from rev 204317, trunk/Source/WebKit2/UIProcess/Gamepad/UIGamepadProvider.h) (0 => 204318)
--- trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Gamepad/mac/UIGamepadProviderMac.mm 2016-08-10 00:49:34 UTC (rev 204318)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * 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.
+ */
+
+#import "config.h"
+#import "UIGamepadProvider.h"
+
+#if ENABLE(GAMEPAD)
+
+#import "WebPageProxy.h"
+#import "WKAPICast.h"
+#import "WKViewInternal.h"
+#import "WKWebViewInternal.h"
+
+namespace WebKit {
+
+WebPageProxy* UIGamepadProvider::platformWebPageProxyForGamepadInput()
+{
+ auto responder = [[NSApp keyWindow] firstResponder];
+
+#if WK_API_ENABLED
+ if ([responder isKindOfClass:[WKWebView class]])
+ return ((WKWebView *)responder)->_page.get();
+#endif
+
+ if ([responder isKindOfClass:[WKView class]])
+ return toImpl(((WKView *)responder).pageRef);
+
+ return nullptr;
+}
+
+}
+
+#endif // ENABLE(GAMEPAD)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-08-10 00:49:34 UTC (rev 204318)
@@ -5470,6 +5470,15 @@
m_backForwardList->clear();
}
+#if ENABLE(GAMEPAD)
+
+void WebPageProxy::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
+{
+ m_process->send(Messages::WebPage::GamepadActivity(gamepadDatas), m_pageID);
+}
+
+#endif
+
void WebPageProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const ProtectionSpace& coreProtectionSpace)
{
#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-08-10 00:49:34 UTC (rev 204318)
@@ -205,6 +205,7 @@
struct ColorSpaceData;
struct EditingRange;
struct EditorState;
+struct GamepadData;
struct LoadParameters;
struct PlatformPopupMenuData;
struct PrintInfo;
@@ -1119,6 +1120,10 @@
void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&);
+#if ENABLE(GAMEPAD)
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-08-10 00:49:34 UTC (rev 204318)
@@ -1286,14 +1286,6 @@
process->send(Messages::WebProcess::GamepadDisconnected(gamepad.index()), 0);
}
-void WebProcessPool::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
-{
- // FIXME (https://bugs.webkit.org/show_bug.cgi?id=160699)
- // Only send updates to the process that contains the currently focused web page.
- for (auto& process : m_processesUsingGamepads)
- process->send(Messages::WebProcess::GamepadActivity(gamepadDatas), 0);
-}
-
#endif // ENABLE(GAMEPAD)
void WebProcessPool::garbageCollectJavaScriptObjects()
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204317 => 204318)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-10 00:49:34 UTC (rev 204318)
@@ -371,7 +371,6 @@
#if ENABLE(GAMEPAD)
void gamepadConnected(const UIGamepad&);
void gamepadDisconnected(const UIGamepad&);
- void gamepadActivity(const Vector<GamepadData>&);
#endif
private:
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (204317 => 204318)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-08-10 00:49:34 UTC (rev 204318)
@@ -948,6 +948,7 @@
515BE1B31D5902DD00DD7C68 /* GamepadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1B01D59006900DD7C68 /* GamepadData.h */; };
515BE1B41D5917FF00DD7C68 /* UIGamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1AC1D555C5100DD7C68 /* UIGamepad.cpp */; };
515BE1B51D5917FF00DD7C68 /* UIGamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = 515BE1AD1D555C5100DD7C68 /* UIGamepad.h */; };
+ 515BE1B71D5A94FD00DD7C68 /* UIGamepadProviderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 515BE1B61D5A94F900DD7C68 /* UIGamepadProviderMac.mm */; };
515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7725183DD6F60007203F /* AsyncRequest.cpp */; };
515E7728183DD6F60007203F /* AsyncRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 515E7726183DD6F60007203F /* AsyncRequest.h */; };
515E772B184008B90007203F /* DatabaseProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */; };
@@ -3000,6 +3001,7 @@
515BE1AD1D555C5100DD7C68 /* UIGamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGamepad.h; sourceTree = "<group>"; };
515BE1B01D59006900DD7C68 /* GamepadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadData.h; sourceTree = "<group>"; };
515BE1B11D5902B600DD7C68 /* GamepadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadData.cpp; sourceTree = "<group>"; };
+ 515BE1B61D5A94F900DD7C68 /* UIGamepadProviderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UIGamepadProviderMac.mm; path = UIProcess/Gamepad/mac/UIGamepadProviderMac.mm; sourceTree = SOURCE_ROOT; };
515E7725183DD6F60007203F /* AsyncRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncRequest.cpp; sourceTree = "<group>"; };
515E7726183DD6F60007203F /* AsyncRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncRequest.h; sourceTree = "<group>"; };
515E7729184008B90007203F /* DatabaseProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseProcessCreationParameters.cpp; sourceTree = "<group>"; };
@@ -5524,6 +5526,7 @@
isa = PBXGroup;
children = (
515BE1A61D55293000DD7C68 /* UIGamepadProviderHID.cpp */,
+ 515BE1B61D5A94F900DD7C68 /* UIGamepadProviderMac.mm */,
);
name = mac;
path = UIProcess/Gamepad/mac;
@@ -9474,6 +9477,7 @@
BCD59800112B57BE00EC8C23 /* WebPreferences.cpp in Sources */,
7C85FD7F19341665000177C4 /* WebPreferencesKeys.cpp in Sources */,
BC84EB1812A7100C0083F2DA /* WebPreferencesMac.mm in Sources */,
+ 515BE1B71D5A94FD00DD7C68 /* UIGamepadProviderMac.mm in Sources */,
BCD598AD112B7FDF00EC8C23 /* WebPreferencesStore.cpp in Sources */,
BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */,
7C6E70FB18B2DC7A00F24E2E /* WebProcessCocoa.mm in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-08-10 00:49:34 UTC (rev 204318)
@@ -79,6 +79,7 @@
#include "WebFrameLoaderClient.h"
#include "WebFullScreenManager.h"
#include "WebFullScreenManagerMessages.h"
+#include "WebGamepadProvider.h"
#include "WebGeolocationClient.h"
#include "WebImage.h"
#include "WebInspector.h"
@@ -5463,4 +5464,13 @@
m_page->setUserInterfaceLayoutDirection(m_userInterfaceLayoutDirection);
}
+#if ENABLE(GAMEPAD)
+
+void WebPage::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
+{
+ WebGamepadProvider::singleton().gamepadActivity(gamepadDatas);
+}
+
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-08-10 00:49:34 UTC (rev 204318)
@@ -192,6 +192,7 @@
struct BackForwardListItemState;
struct EditingRange;
struct EditorState;
+struct GamepadData;
struct InteractionInformationAtPosition;
struct LoadParameters;
struct PrintInfo;
@@ -949,6 +950,10 @@
std::chrono::system_clock::time_point loadCommitTime() const { return m_loadCommitTime; }
#endif
+#if ENABLE(GAMEPAD)
+ void gamepadActivity(const Vector<GamepadData>&);
+#endif
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-08-10 00:49:34 UTC (rev 204318)
@@ -433,4 +433,8 @@
SetResourceCachingDisabled(bool disabled)
SetUserInterfaceLayoutDirection(uint32_t direction)
+
+#if ENABLE(GAMEPAD)
+ GamepadActivity(Vector<WebKit::GamepadData> gamepadDatas)
+#endif
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-10 00:49:34 UTC (rev 204318)
@@ -1042,11 +1042,6 @@
WebGamepadProvider::singleton().gamepadDisconnected(index);
}
-void WebProcess::gamepadActivity(const Vector<GamepadData>& gamepadDatas)
-{
- WebGamepadProvider::singleton().gamepadActivity(gamepadDatas);
-}
-
#endif
void WebProcess::setJavaScriptGarbageCollectorTimerEnabled(bool flag)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2016-08-10 00:49:34 UTC (rev 204318)
@@ -279,7 +279,6 @@
#if ENABLE(GAMEPAD)
void gamepadConnected(const GamepadData&);
void gamepadDisconnected(unsigned index);
- void gamepadActivity(const Vector<GamepadData>&);
#endif
void releasePageCache();
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (204317 => 204318)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2016-08-10 00:31:38 UTC (rev 204317)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2016-08-10 00:49:34 UTC (rev 204318)
@@ -105,6 +105,5 @@
#if ENABLE(GAMEPAD)
GamepadConnected(struct WebKit::GamepadData gamepadData)
GamepadDisconnected(unsigned index)
- GamepadActivity(Vector<WebKit::GamepadData> gamepadDatas)
#endif
}