Changeset 247662 in webkit
- Timestamp:
- Jul 19, 2019 5:55:16 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247655 r247662 1 2019-07-19 Youenn Fablet <youenn@apple.com> 2 3 Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=199924 5 <rdar://problem/50552067> 6 7 Reviewed by Devin Rousso. 8 9 Add necessary API to set mock capture devices override. 10 In case of desynchronization between webprocess and uiprocess, make sure to return early 11 and fail capture instead of crashing. 12 13 * inspector/InspectorClient.h: 14 (WebCore::InspectorClient::setMockCaptureDevicesEnabled): 15 * inspector/agents/InspectorPageAgent.cpp: 16 (WebCore::InspectorPageAgent::disable): 17 (WebCore::InspectorPageAgent::overrideSetting): 18 * platform/mock/MockRealtimeMediaSourceCenter.cpp: 19 1 20 2019-07-19 Andy Estes <aestes@apple.com> 2 21 -
trunk/Source/WebCore/inspector/InspectorClient.h
r238192 r247662 28 28 29 29 #include <wtf/Forward.h> 30 #include <wtf/Optional.h> 30 31 31 32 namespace Inspector { … … 63 64 virtual void elementSelectionChanged(bool) { } 64 65 66 virtual void setMockCaptureDevicesEnabledOverride(Optional<bool>) { } 67 65 68 #if ENABLE(REMOTE_INSPECTOR) 66 69 virtual bool allowRemoteInspectionToPageDirectly() const { return false; } -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
r247438 r247662 389 389 #undef DISABLE_INSPECTOR_OVERRIDE_SETTING 390 390 391 m_client->setMockCaptureDevicesEnabledOverride(WTF::nullopt); 392 391 393 m_instrumentingAgents.setInspectorPageAgent(nullptr); 392 394 } … … 436 438 switch (setting.value()) { 437 439 #define CASE_INSPECTOR_OVERRIDE_SETTING(name) \ 438 case Inspector::Protocol::Page::Setting::name: { \439 if (value) \440 m_inspectedPage.settings().set##name##InspectorOverride(*value); \441 else \440 case Inspector::Protocol::Page::Setting::name: { \ 441 if (value) \ 442 m_inspectedPage.settings().set##name##InspectorOverride(*value); \ 443 else \ 442 444 m_inspectedPage.settings().set##name##InspectorOverride(WTF::nullopt); \ 443 return;\444 } \445 break; \ 446 } \ 445 447 446 448 FOR_EACH_INSPECTOR_OVERRIDE_SETTING(CASE_INSPECTOR_OVERRIDE_SETTING) … … 449 451 } 450 452 451 ASSERT_NOT_REACHED(); 453 // Update the UIProcess / client for particular overrides. 454 if (setting.value() == Inspector::Protocol::Page::Setting::MockCaptureDevicesEnabled) 455 m_client->setMockCaptureDevicesEnabledOverride(value); 452 456 } 453 457 -
trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
r246002 r247662 90 90 { 91 91 ASSERT(device.type() == CaptureDevice::DeviceType::Camera); 92 ASSERT(MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType::Camera, device.persistentId())); 92 if (!MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType::Camera, device.persistentId())) 93 return { }; 93 94 94 95 return MockRealtimeVideoSource::create(String { device.persistentId() }, String { device.label() }, WTFMove(hashSalt), constraints); … … 110 111 CaptureSourceOrError createDisplayCaptureSource(const CaptureDevice& device, const MediaConstraints* constraints) final 111 112 { 112 ASSERT(MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(device.type(), device.persistentId())); 113 if (!MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(device.type(), device.persistentId())) 114 return { }; 113 115 114 116 switch (device.type()) { … … 135 137 { 136 138 ASSERT(device.type() == CaptureDevice::DeviceType::Microphone); 137 ASSERT(MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType::Microphone, device.persistentId())); 139 if (!MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID(CaptureDevice::DeviceType::Microphone, device.persistentId())) 140 return { }; 138 141 139 142 return MockRealtimeAudioSource::create(String { device.persistentId() }, String { device.label() }, WTFMove(hashSalt), constraints); -
trunk/Source/WebKit/ChangeLog
r247658 r247662 1 2019-07-19 Youenn Fablet <youenn@apple.com> 2 3 Remote WebInspector should enable mock capture devices in UIProcess if doing it in WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=199924 5 <rdar://problem/50552067> 6 7 Reviewed by Devin Rousso. 8 9 Add IPC plumbery to pass inspector override value for mock capture devices. 10 Add an override in UserMediaPermissionRequestManagerProxy so that the value stays in sync with web inspector. 11 The override will be removed when web inspector goes away. 12 13 * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: 14 (WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const): 15 * UIProcess/UserMediaPermissionRequestManagerProxy.h: 16 (WebKit::UserMediaPermissionRequestManagerProxy::setMockCaptureDevicesEnabledOverride): 17 * UIProcess/WebInspectorProxy.cpp: 18 (WebKit::WebInspectorProxy::setMockCaptureDevicesEnabled): 19 * UIProcess/WebInspectorProxy.h: 20 * UIProcess/WebInspectorProxy.messages.in: 21 * UIProcess/WebPageProxy.cpp: 22 (WebKit::WebPageProxy::setMockCaptureDevicesEnabledOverride): 23 * UIProcess/WebPageProxy.h: 24 * WebProcess/WebCoreSupport/WebInspectorClient.cpp: 25 (WebKit::WebInspectorClient::setMockCaptureDevicesEnabled): 26 * WebProcess/WebCoreSupport/WebInspectorClient.h: 27 * WebProcess/WebPage/WebInspector.cpp: 28 (WebKit::WebInspector::setMockCaptureDevicesEnabled): 29 * WebProcess/WebPage/WebInspector.h: 30 1 31 2019-07-19 Tim Horton <timothy_horton@apple.com> 2 32 -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
r246185 r247662 652 652 // Enable/disable the mock capture devices for the UI process as per the WebCore preferences. Note that 653 653 // this is a noop if the preference hasn't changed since the last time this was called. 654 bool mockDevicesEnabled = m_ page.preferences().mockCaptureDevicesEnabled();654 bool mockDevicesEnabled = m_mockDevicesEnabledOverride ? *m_mockDevicesEnabledOverride : m_page.preferences().mockCaptureDevicesEnabled(); 655 655 MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled(mockDevicesEnabled); 656 656 #endif -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h
r246185 r247662 86 86 }; 87 87 88 void setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) { m_mockDevicesEnabledOverride = enabled; } 89 88 90 private: 89 91 #if !RELEASE_LOG_DISABLED … … 151 153 bool m_hasFilteredDeviceList { false }; 152 154 uint64_t m_hasPendingCapture { 0 }; 155 Optional<bool> m_mockDevicesEnabledOverride; 153 156 }; 154 157 -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.cpp
r247043 r247662 43 43 #include "WebProcessProxy.h" 44 44 #include <WebCore/CertificateInfo.h> 45 #include <WebCore/MockRealtimeMediaSourceCenter.h> 45 46 #include <WebCore/NotImplemented.h> 46 47 #include <WebCore/TextEncoding.h> … … 593 594 } 594 595 596 void WebInspectorProxy::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) 597 { 598 #if ENABLE(MEDIA_STREAM) 599 if (!m_inspectedPage) 600 return; 601 602 m_inspectedPage->setMockCaptureDevicesEnabledOverride(enabled); 603 #else 604 UNUSED_PARAM(enabled); 605 #endif 606 } 607 595 608 void WebInspectorProxy::save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs) 596 609 { -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.h
r247043 r247662 228 228 void showCertificate(const WebCore::CertificateInfo&); 229 229 void elementSelectionChanged(bool); 230 void setMockCaptureDevicesEnabledOverride(Optional<bool>); 230 231 231 232 void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs); -
trunk/Source/WebKit/UIProcess/WebInspectorProxy.messages.in
r247043 r247662 36 36 ShowCertificate(WebCore::CertificateInfo certificateInfo) 37 37 ElementSelectionChanged(bool active) 38 SetMockCaptureDevicesEnabledOverride(Optional<bool> enabled) 38 39 39 40 Save(String filename, String content, bool base64Encoded, bool forceSaveAs) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r247490 r247662 7395 7395 return *m_userMediaPermissionRequestManager; 7396 7396 } 7397 7398 void WebPageProxy::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) 7399 { 7400 userMediaPermissionRequestManager().setMockCaptureDevicesEnabledOverride(enabled); 7401 } 7397 7402 #endif 7398 7403 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r247490 r247662 1562 1562 URL currentResourceDirectoryURL() const; 1563 1563 1564 #if ENABLE(MEDIA_STREAM) 1565 void setMockCaptureDevicesEnabledOverride(Optional<bool>); 1566 #endif 1567 1564 1568 private: 1565 1569 WebPageProxy(PageClient&, WebProcessProxy&, WebCore::PageIdentifier, Ref<API::PageConfiguration>&&); -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.cpp
r241183 r247662 212 212 } 213 213 214 void WebInspectorClient::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) 215 { 216 if (m_page->inspector()) 217 m_page->inspector()->setMockCaptureDevicesEnabledOverride(enabled); 218 } 219 214 220 void WebInspectorClient::willMoveToPage(PageOverlay&, Page* page) 215 221 { -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebInspectorClient.h
r237266 r247662 72 72 void showPaintRect(const WebCore::FloatRect&) override; 73 73 74 void setMockCaptureDevicesEnabledOverride(Optional<bool>) final; 75 74 76 // PageOverlay::Client 75 77 void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; -
trunk/Source/WebKit/WebProcess/WebPage/WebInspector.cpp
r244167 r247662 285 285 } 286 286 287 void WebInspector::setMockCaptureDevicesEnabledOverride(Optional<bool> enabled) 288 { 289 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetMockCaptureDevicesEnabledOverride(enabled), m_page->pageID()); 290 } 291 287 292 bool WebInspector::canAttachWindow() 288 293 { -
trunk/Source/WebKit/WebProcess/WebPage/WebInspector.h
r238660 r247662 74 74 void stopElementSelection(); 75 75 void elementSelectionChanged(bool); 76 void setMockCaptureDevicesEnabledOverride(Optional<bool>); 76 77 77 78 void setFrontendConnection(IPC::Attachment);
Note: See TracChangeset
for help on using the changeset viewer.