Changeset 243328 in webkit
- Timestamp:
- Mar 21, 2019 2:15:29 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r243319 r243328 1 2019-03-21 Eric Carlson <eric.carlson@apple.com> 2 3 Add UI process WebRTC runtime logging. 4 https://bugs.webkit.org/show_bug.cgi?id=196020 5 <rdar://problem/49071443> 6 7 Reviewed by Youenn Fablet. 8 9 * inspector/console/webcore-logging.html: 10 * inspector/console/webcore-logging-expected.txt: 11 1 12 2019-03-21 Alex Christensen <achristensen@webkit.org> 2 13 -
trunk/LayoutTests/inspector/console/webcore-logging-expected.txt
r241729 r243328 16 16 PASS: Log channel has known source. 17 17 PASS: Log channel disabled by default. 18 19 -- Running test case: Console.Logging.InvalidChannel20 PASS: Logging channel not found21 18 22 19 -- Running test case: Console.Logging.InvalidLevel -
trunk/LayoutTests/inspector/console/webcore-logging.html
r236766 r243328 64 64 }); 65 65 66 resolve();67 });68 }69 });70 71 suite.addTestCase({72 name: "Console.Logging.InvalidChannel",73 description: "setLoggingChannelLevel should reject invalid log channel name.",74 test(resolve, reject) {75 ConsoleAgent.setLoggingChannelLevel("DOES_NOT_EXIST", WI.LoggingChannel.Level.Off, (error) => {76 if (!error) {77 InspectorTest.fail("Should have an error with invalid channel.");78 reject();79 return;80 }81 InspectorTest.pass(error);82 66 resolve(); 83 67 }); -
trunk/Source/WTF/ChangeLog
r243275 r243328 1 2019-03-21 Eric Carlson <eric.carlson@apple.com> 2 3 Add UI process WebRTC runtime logging. 4 https://bugs.webkit.org/show_bug.cgi?id=196020 5 <rdar://problem/49071443> 6 7 Reviewed by Youenn Fablet. 8 9 * wtf/Logger.h: 10 (WTF::LogArgument::toString): Add long long and unsigned long long variants. 11 1 12 2019-03-20 Simon Fraser <simon.fraser@apple.com> 2 13 -
trunk/Source/WTF/wtf/Logger.h
r243141 r243328 37 37 template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned long>::value, String>::type toString(unsigned long argument) { return String::number(argument); } 38 38 template<typename U = T> static typename std::enable_if<std::is_same<U, long>::value, String>::type toString(long argument) { return String::number(argument); } 39 template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned long long>::value, String>::type toString(unsigned long argument) { return String::number(argument); } 40 template<typename U = T> static typename std::enable_if<std::is_same<U, long long>::value, String>::type toString(long argument) { return String::number(argument); } 39 41 template<typename U = T> static typename std::enable_if<std::is_enum<U>::value, String>::type toString(U argument) { return String::number(static_cast<typename std::underlying_type<U>::type>(argument)); } 40 42 template<typename U = T> static typename std::enable_if<std::is_same<U, float>::value, String>::type toString(float argument) { return String::numberToStringFixedPrecision(argument); } -
trunk/Source/WebCore/ChangeLog
r243324 r243328 1 2019-03-21 Eric Carlson <eric.carlson@apple.com> 2 3 Add UI process WebRTC runtime logging. 4 https://bugs.webkit.org/show_bug.cgi?id=196020 5 <rdar://problem/49071443> 6 7 Reviewed by Youenn Fablet. 8 9 * inspector/agents/WebConsoleAgent.cpp: 10 (WebCore::WebConsoleAgent::getLoggingChannels): Deleted. 11 (WebCore::channelConfigurationForString): Deleted. 12 (WebCore::WebConsoleAgent::setLoggingChannelLevel): Deleted. 13 * inspector/agents/WebConsoleAgent.h: 14 * inspector/agents/page/PageConsoleAgent.cpp: 15 (WebCore::PageConsoleAgent::PageConsoleAgent): Change 'context' parameter from 16 WebAgentContext to PageAgentContext. Store the inspected page for later use. 17 (WebCore::PageConsoleAgent::getLoggingChannels): Moved from WebConsoleAgent. 18 (WebCore::channelConfigurationForString): Ditto. 19 (WebCore::PageConsoleAgent::setLoggingChannelLevel): Moved from WebConsoleAgent. 20 Call the inspected page to actually change the log channel configuration. 21 * inspector/agents/page/PageConsoleAgent.h: 22 * page/ChromeClient.h: 23 * page/Page.cpp: 24 (WebCore::Page::configureLoggingChannel): New. 25 * page/Page.h: 26 1 27 2019-03-21 Andy Estes <aestes@apple.com> 2 28 -
trunk/Source/WebCore/inspector/agents/WebConsoleAgent.cpp
r243150 r243328 49 49 } 50 50 51 void WebConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>& channels)52 {53 static const struct ChannelTable {54 NeverDestroyed<String> name;55 Inspector::Protocol::Console::ChannelSource source;56 } channelTable[] = {57 { MAKE_STATIC_STRING_IMPL("WebRTC"), Inspector::Protocol::Console::ChannelSource::WebRTC },58 { MAKE_STATIC_STRING_IMPL("Media"), Inspector::Protocol::Console::ChannelSource::Media },59 { MAKE_STATIC_STRING_IMPL("MediaSource"), Inspector::Protocol::Console::ChannelSource::MediaSource },60 };61 62 channels = JSON::ArrayOf<Inspector::Protocol::Console::Channel>::create();63 64 size_t length = WTF_ARRAY_LENGTH(channelTable);65 for (size_t i = 0; i < length; ++i) {66 auto* logChannel = getLogChannel(channelTable[i].name);67 if (!logChannel)68 return;69 70 auto level = Inspector::Protocol::Console::ChannelLevel::Off;71 if (logChannel->state != WTFLogChannelState::Off) {72 switch (logChannel->level) {73 case WTFLogLevel::Always:74 case WTFLogLevel::Error:75 case WTFLogLevel::Warning:76 case WTFLogLevel::Info:77 level = Inspector::Protocol::Console::ChannelLevel::Basic;78 break;79 case WTFLogLevel::Debug:80 level = Inspector::Protocol::Console::ChannelLevel::Verbose;81 break;82 }83 }84 85 auto channel = Inspector::Protocol::Console::Channel::create()86 .setSource(channelTable[i].source)87 .setLevel(level)88 .release();89 channels->addItem(WTFMove(channel));90 }91 }92 93 static Optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfigurationForString(const String& levelString)94 {95 WTFLogChannelState state;96 WTFLogLevel level;97 98 if (equalIgnoringASCIICase(levelString, "off")) {99 state = WTFLogChannelState::Off;100 level = WTFLogLevel::Error;101 } else {102 state = WTFLogChannelState::On;103 if (equalIgnoringASCIICase(levelString, "basic"))104 level = WTFLogLevel::Warning;105 else if (equalIgnoringASCIICase(levelString, "verbose"))106 level = WTFLogLevel::Debug;107 else108 return WTF::nullopt;109 }110 111 return { { state, level } };112 }113 114 void WebConsoleAgent::setLoggingChannelLevel(ErrorString& errorString, const String& channelName, const String& channelLevel)115 {116 auto* channel = getLogChannel(channelName.utf8().data());117 if (!channel) {118 errorString = "Logging channel not found"_s;119 return;120 }121 122 auto configuration = channelConfigurationForString(channelLevel);123 if (!configuration) {124 errorString = "Invalid logging level"_s;125 return;126 }127 128 channel->state = configuration.value().first;129 channel->level = configuration.value().second;130 }131 132 51 void WebConsoleAgent::frameWindowDiscarded(DOMWindow* window) 133 52 { -
trunk/Source/WebCore/inspector/agents/WebConsoleAgent.h
r243150 r243328 44 44 void frameWindowDiscarded(DOMWindow*); 45 45 46 void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>&) final;47 void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) final;48 49 46 void didReceiveResponse(unsigned long requestIdentifier, const ResourceResponse&); 50 47 void didFailLoading(unsigned long requestIdentifier, const ResourceError&); -
trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.cpp
r243273 r243328 43 43 using namespace Inspector; 44 44 45 PageConsoleAgent::PageConsoleAgent( WebAgentContext& context)45 PageConsoleAgent::PageConsoleAgent(PageAgentContext& context) 46 46 : WebConsoleAgent(context) 47 47 , m_instrumentingAgents(context.instrumentingAgents) 48 , m_inspectedPage(context.inspectedPage) 48 49 { 49 50 } … … 57 58 } 58 59 60 void PageConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>& channels) 61 { 62 static const struct ChannelTable { 63 NeverDestroyed<String> name; 64 Inspector::Protocol::Console::ChannelSource source; 65 } channelTable[] = { 66 { MAKE_STATIC_STRING_IMPL("WebRTC"), Inspector::Protocol::Console::ChannelSource::WebRTC }, 67 { MAKE_STATIC_STRING_IMPL("Media"), Inspector::Protocol::Console::ChannelSource::Media }, 68 { MAKE_STATIC_STRING_IMPL("MediaSource"), Inspector::Protocol::Console::ChannelSource::MediaSource }, 69 }; 70 71 channels = JSON::ArrayOf<Inspector::Protocol::Console::Channel>::create(); 72 73 size_t length = WTF_ARRAY_LENGTH(channelTable); 74 for (size_t i = 0; i < length; ++i) { 75 auto* logChannel = getLogChannel(channelTable[i].name); 76 if (!logChannel) 77 return; 78 79 auto level = Inspector::Protocol::Console::ChannelLevel::Off; 80 if (logChannel->state != WTFLogChannelState::Off) { 81 switch (logChannel->level) { 82 case WTFLogLevel::Always: 83 case WTFLogLevel::Error: 84 case WTFLogLevel::Warning: 85 case WTFLogLevel::Info: 86 level = Inspector::Protocol::Console::ChannelLevel::Basic; 87 break; 88 case WTFLogLevel::Debug: 89 level = Inspector::Protocol::Console::ChannelLevel::Verbose; 90 break; 91 } 92 } 93 94 auto channel = Inspector::Protocol::Console::Channel::create() 95 .setSource(channelTable[i].source) 96 .setLevel(level) 97 .release(); 98 channels->addItem(WTFMove(channel)); 99 } 100 } 101 102 static Optional<std::pair<WTFLogChannelState, WTFLogLevel>> channelConfigurationForString(const String& levelString) 103 { 104 if (equalIgnoringASCIICase(levelString, "off")) 105 return { { WTFLogChannelState::Off, WTFLogLevel::Error } }; 106 107 if (equalIgnoringASCIICase(levelString, "basic")) 108 return { { WTFLogChannelState::On, WTFLogLevel::Info } }; 109 110 if (equalIgnoringASCIICase(levelString, "verbose")) 111 return { { WTFLogChannelState::On, WTFLogLevel::Debug } }; 112 113 return WTF::nullopt; 114 } 115 116 void PageConsoleAgent::setLoggingChannelLevel(ErrorString& errorString, const String& channelName, const String& channelLevel) 117 { 118 auto configuration = channelConfigurationForString(channelLevel); 119 if (!configuration) { 120 errorString = "Invalid logging level"_s; 121 return; 122 } 123 124 m_inspectedPage.configureLoggingChannel(channelName, configuration.value().first, configuration.value().second); 125 } 126 59 127 } // namespace WebCore -
trunk/Source/WebCore/inspector/agents/page/PageConsoleAgent.h
r243273 r243328 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 PageConsoleAgent( WebAgentContext&);43 PageConsoleAgent(PageAgentContext&); 44 44 virtual ~PageConsoleAgent() = default; 45 46 void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>&) final; 47 void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) final; 45 48 46 49 private: … … 48 51 49 52 InstrumentingAgents& m_instrumentingAgents; 53 Page& m_inspectedPage; 50 54 }; 51 55 -
trunk/Source/WebCore/page/ChromeClient.h
r243319 r243328 46 46 #include "WebCoreKeyboardUIMode.h" 47 47 #include <JavaScriptCore/ConsoleTypes.h> 48 #include <wtf/Assertions.h> 48 49 #include <wtf/CompletionHandler.h> 49 50 #include <wtf/Forward.h> … … 499 500 virtual void didDestroyEditableImage(GraphicsLayer::EmbeddedViewID) { } 500 501 502 virtual void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel) { } 503 501 504 protected: 502 505 virtual ~ChromeClient() = default; -
trunk/Source/WebCore/page/Page.cpp
r243002 r243328 2911 2911 #endif 2912 2912 2913 void Page::configureLoggingChannel(const String& channelName, WTFLogChannelState state, WTFLogLevel level) 2914 { 2915 #if !RELEASE_LOG_DISABLED 2916 if (auto* channel = getLogChannel(channelName)) { 2917 channel->state = state; 2918 channel->level = level; 2919 } 2920 2921 chrome().client().configureLoggingChannel(channelName, state, level); 2922 #else 2923 UNUSED_PARAM(channelName); 2924 UNUSED_PARAM(state); 2925 UNUSED_PARAM(level); 2926 #endif 2927 } 2928 2913 2929 } // namespace WebCore -
trunk/Source/WebCore/page/Page.h
r243002 r243328 43 43 #include <memory> 44 44 #include <pal/SessionID.h> 45 #include <wtf/Assertions.h> 45 46 #include <wtf/Forward.h> 46 47 #include <wtf/Function.h> … … 705 706 PerformanceLogging& performanceLogging() const { return *m_performanceLogging; } 706 707 708 void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel); 709 707 710 private: 708 711 struct Navigation { -
trunk/Source/WebKit/ChangeLog
r243327 r243328 1 2019-03-21 Eric Carlson <eric.carlson@apple.com> 2 3 Add UI process WebRTC runtime logging. 4 https://bugs.webkit.org/show_bug.cgi?id=196020 5 <rdar://problem/49071443> 6 7 Reviewed by Youenn Fablet. 8 9 * Platform/Logging.cpp: 10 (WebKit::getLogChannel): New. 11 * Platform/Logging.h: 12 * Shared/WebCoreArgumentCoders.h: Add coders for WTFLogChannelState and WTFLogLevel. 13 14 Add runtime logging. 15 * UIProcess/UserMediaPermissionRequestManagerProxy.cpp: 16 (WebKit::UserMediaPermissionRequestManagerProxy::UserMediaPermissionRequestManagerProxy): 17 (WebKit::UserMediaPermissionRequestManagerProxy::stopCapture): 18 (WebKit::UserMediaPermissionRequestManagerProxy::captureDevicesChanged): 19 (WebKit::UserMediaPermissionRequestManagerProxy::clearCachedState): 20 (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasDenied): 21 (WebKit::UserMediaPermissionRequestManagerProxy::denyRequest): 22 (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted): 23 (WebKit::UserMediaPermissionRequestManagerProxy::resetAccess): 24 (WebKit::UserMediaPermissionRequestManagerProxy::grantAccess): 25 (WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame): 26 (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest): 27 (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest): 28 (WebKit::UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest): 29 (WebKit::UserMediaPermissionRequestManagerProxy::computeFilteredDeviceList): 30 (WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame): 31 (WebKit::UserMediaPermissionRequestManagerProxy::captureStateChanged): 32 (WebKit::UserMediaPermissionRequestManagerProxy::watchdogTimerFired): 33 (WebKit::UserMediaPermissionRequestManagerProxy::logChannel const): 34 (WebKit::convertEnumerationToString): 35 36 * UIProcess/UserMediaPermissionRequestManagerProxy.h: 37 (WTF::LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction>::toString): 38 * UIProcess/UserMediaPermissionRequestProxy.cpp: 39 (WebKit::convertEnumerationToString): Add an enum specialization for logging. 40 41 * UIProcess/UserMediaPermissionRequestProxy.h: 42 (WTF::LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason>::toString): Ditto. 43 44 * UIProcess/WebPageProxy.cpp: 45 (WebKit::WebPageProxy::logger): 46 (WebKit::WebPageProxy::configureLoggingChannel): 47 * UIProcess/WebPageProxy.h: 48 * UIProcess/WebPageProxy.messages.in: 49 50 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 51 (WebKit::WebChromeClient::configureLoggingChannel): 52 * WebProcess/WebCoreSupport/WebChromeClient.h: 53 * WebProcess/WebPage/WebPage.cpp: 54 (WebKit::WebPage::configureLoggingChannel): 55 * WebProcess/WebPage/WebPage.h: 56 1 57 2019-03-21 Alex Christensen <achristensen@webkit.org> 2 58 -
trunk/Source/WebKit/Platform/Logging.cpp
r239427 r243328 56 56 } 57 57 58 WTFLogChannel* getLogChannel(const String& name) 59 { 60 return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data()); 61 } 62 58 63 } // namespace WebKit 59 64 -
trunk/Source/WebKit/Platform/Logging.h
r242031 r243328 93 93 #undef DECLARE_LOG_CHANNEL 94 94 95 namespace WebKit { 96 WTFLogChannel* getLogChannel(const String&); 97 } // namespace WebKit 98 95 99 #ifdef __cplusplus 96 100 } -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h
r242995 r243328 866 866 #endif 867 867 868 template<> struct EnumTraits<WTFLogChannelState> { 869 using values = EnumValues< 870 WTFLogChannelState, 871 WTFLogChannelState::Off, 872 WTFLogChannelState::On, 873 WTFLogChannelState::OnWithAccumulation 874 >; 875 }; 876 877 #undef Always 878 template<> struct EnumTraits<WTFLogLevel> { 879 using values = EnumValues< 880 WTFLogLevel, 881 WTFLogLevel::Always, 882 WTFLogLevel::Error, 883 WTFLogLevel::Warning, 884 WTFLogLevel::Info, 885 WTFLogLevel::Debug 886 >; 887 }; 888 868 889 } // namespace WTF -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
r243094 r243328 24 24 #include "APIUIClient.h" 25 25 #include "DeviceIdHashSaltStorage.h" 26 #include "Logging.h" 26 27 #include "UserMediaPermissionRequestManager.h" 27 28 #include "UserMediaProcessManager.h" … … 70 71 , m_rejectionTimer(RunLoop::main(), this, &UserMediaPermissionRequestManagerProxy::rejectionTimerFired) 71 72 , m_watchdogTimer(RunLoop::main(), this, &UserMediaPermissionRequestManagerProxy::watchdogTimerFired) 73 #if !RELEASE_LOG_DISABLED 74 , m_logger(page.logger()) 75 , m_logIdentifier(uniqueLogIdentifier()) 76 #endif 72 77 { 73 78 #if ENABLE(MEDIA_STREAM) … … 96 101 void UserMediaPermissionRequestManagerProxy::stopCapture() 97 102 { 103 ALWAYS_LOG(LOGIDENTIFIER); 98 104 invalidatePendingRequests(); 99 105 m_page.stopMediaCapture(); … … 103 109 { 104 110 #if ENABLE(MEDIA_STREAM) 111 ALWAYS_LOG(LOGIDENTIFIER); 105 112 if (!m_page.hasRunningProcess() || !m_page.mainFrame()) 106 113 return; … … 123 130 void UserMediaPermissionRequestManagerProxy::clearCachedState() 124 131 { 132 ALWAYS_LOG(LOGIDENTIFIER); 125 133 invalidatePendingRequests(); 126 134 } … … 156 164 return; 157 165 166 ALWAYS_LOG(LOGIDENTIFIER, userMediaID, ", reason: ", reason); 167 158 168 auto request = m_pendingUserMediaRequests.take(userMediaID); 159 169 if (!request) … … 169 179 { 170 180 ASSERT(m_page.hasRunningProcess()); 181 182 ALWAYS_LOG(LOGIDENTIFIER, userMediaID, ", reason: ", reason); 171 183 172 184 #if ENABLE(MEDIA_STREAM) … … 186 198 187 199 #if ENABLE(MEDIA_STREAM) 200 auto logSiteIdentifier = LOGIDENTIFIER; 201 ALWAYS_LOG(logSiteIdentifier, userMediaID, ", video: ", videoDevice ? videoDevice.label() : "", ", audio: ", audioDevice ? audioDevice.label() : " "); 202 188 203 auto request = m_pendingUserMediaRequests.take(userMediaID); 189 204 if (!request) … … 192 207 auto& userMediaDocumentSecurityOrigin = request->userMediaDocumentSecurityOrigin(); 193 208 auto& topLevelDocumentSecurityOrigin = request->topLevelDocumentSecurityOrigin(); 194 m_page.websiteDataStore().deviceIdHashSaltStorage().deviceIdHashSaltForOrigin(userMediaDocumentSecurityOrigin, topLevelDocumentSecurityOrigin, [this, weakThis = makeWeakPtr(*this), request = request.releaseNonNull() ] (String&& deviceIDHashSalt) mutable {209 m_page.websiteDataStore().deviceIdHashSaltStorage().deviceIdHashSaltForOrigin(userMediaDocumentSecurityOrigin, topLevelDocumentSecurityOrigin, [this, weakThis = makeWeakPtr(*this), request = request.releaseNonNull(), logSiteIdentifier] (String&& deviceIDHashSalt) mutable { 195 210 if (!weakThis) 196 211 return; … … 198 213 return; 199 214 215 ALWAYS_LOG(logSiteIdentifier, deviceIDHashSalt); 200 216 m_grantedRequests.append(WTFMove(request)); 201 217 if (m_hasFilteredDeviceList) … … 213 229 void UserMediaPermissionRequestManagerProxy::resetAccess(uint64_t frameID) 214 230 { 231 ALWAYS_LOG(LOGIDENTIFIER, frameID); 215 232 m_grantedRequests.removeAllMatching([frameID](const auto& grantedRequest) { 216 233 return grantedRequest->mainFrameID() == frameID; … … 273 290 bool UserMediaPermissionRequestManagerProxy::grantAccess(const UserMediaPermissionRequestProxy& request) 274 291 { 292 ALWAYS_LOG(LOGIDENTIFIER, request.userMediaID()); 275 293 if (!UserMediaProcessManager::singleton().willCreateMediaStream(*this, request.hasAudioDevice(), request.hasVideoDevice())) { 276 294 denyRequest(request.userMediaID(), UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::OtherFailure, "Unable to extend sandbox."); … … 323 341 { 324 342 #if ENABLE(MEDIA_STREAM) 343 auto logSiteIdentifier = LOGIDENTIFIER; 344 325 345 if (!UserMediaProcessManager::singleton().captureEnabled()) { 346 ALWAYS_LOG(logSiteIdentifier, "capture disabled"); 326 347 m_pendingRejections.append(userMediaID); 327 348 scheduleNextRejection(); … … 332 353 return; 333 354 355 ALWAYS_LOG(logSiteIdentifier, userMediaID); 356 334 357 auto request = m_pendingUserMediaRequests.add(userMediaID, UserMediaPermissionRequestProxy::create(*this, userMediaID, m_page.mainFrame()->frameID(), frameID, WTFMove(userMediaDocumentOrigin), WTFMove(topLevelDocumentOrigin), { }, { }, WTFMove(userRequest))).iterator->value.copyRef(); 335 358 336 359 auto& userMediaOrigin = request->userMediaDocumentSecurityOrigin(); 337 360 auto& topLevelOrigin = request->topLevelDocumentSecurityOrigin(); 338 getUserMediaPermissionInfo(frameID, userMediaOrigin, topLevelOrigin, [this, request = request.releaseNonNull() ](Optional<bool> hasPersistentAccess) mutable {361 getUserMediaPermissionInfo(frameID, userMediaOrigin, topLevelOrigin, [this, request = request.releaseNonNull(), logSiteIdentifier](Optional<bool> hasPersistentAccess) mutable { 339 362 if (!request->isPending()) 340 363 return; … … 345 368 } 346 369 370 ALWAYS_LOG(logSiteIdentifier, request->userMediaID(), ", persistent access: ", *hasPersistentAccess); 347 371 processUserMediaPermissionRequest(WTFMove(request), *hasPersistentAccess); 348 372 }); … … 351 375 void UserMediaPermissionRequestManagerProxy::processUserMediaPermissionRequest(Ref<UserMediaPermissionRequestProxy>&& request, bool hasPersistentAccess) 352 376 { 377 ALWAYS_LOG(LOGIDENTIFIER, request->userMediaID()); 378 353 379 if (hasPersistentAccess) 354 380 request->setHasPersistentAccess(); … … 396 422 void UserMediaPermissionRequestManagerProxy::processUserMediaPermissionInvalidRequest(const UserMediaPermissionRequestProxy& request, const String& invalidConstraint) 397 423 { 424 ALWAYS_LOG(LOGIDENTIFIER, request.userMediaID()); 398 425 bool filterConstraint = !request.hasPersistentAccess() && !wasGrantedVideoOrAudioAccess(request.frameID(), request.userMediaDocumentSecurityOrigin(), request.topLevelDocumentSecurityOrigin()); 399 426 … … 403 430 void UserMediaPermissionRequestManagerProxy::processUserMediaPermissionValidRequest(Ref<UserMediaPermissionRequestProxy>&& request, Vector<CaptureDevice>&& audioDevices, Vector<CaptureDevice>&& videoDevices, String&& deviceIdentifierHashSalt) 404 431 { 432 ALWAYS_LOG(LOGIDENTIFIER, request->userMediaID(), ", video:, ", videoDevices.size(), " audio: ", audioDevices.size()); 405 433 if (videoDevices.isEmpty() && audioDevices.isEmpty()) { 406 434 denyRequest(request->userMediaID(), UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::NoConstraints, emptyString()); … … 413 441 414 442 auto action = getRequestAction(request); 443 ALWAYS_LOG(LOGIDENTIFIER, request->userMediaID(), ", action: ", action); 444 415 445 if (action == RequestAction::Deny) { 416 446 denyRequest(request->userMediaID(), UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied, emptyString()); … … 431 461 if (m_page.isControlledByAutomation()) { 432 462 if (WebAutomationSession* automationSession = m_page.process().processPool().automationSession()) { 463 ALWAYS_LOG(LOGIDENTIFIER, request->userMediaID(), ", page controlled by automation"); 433 464 if (automationSession->shouldAllowGetUserMediaForPage(m_page)) 434 465 request->allow(); … … 441 472 442 473 if (m_page.preferences().mockCaptureDevicesEnabled() && !m_page.preferences().mockCaptureDevicesPromptEnabled()) { 474 ALWAYS_LOG(LOGIDENTIFIER, request->userMediaID(), ", mock devices don't require prompt"); 443 475 request->allow(); 444 476 return; … … 542 574 543 575 m_hasFilteredDeviceList = !revealIdsAndLabels; 576 577 ALWAYS_LOG(LOGIDENTIFIER, filteredDevices.size(), " devices revealed"); 544 578 return filteredDevices; 545 579 } … … 549 583 { 550 584 #if ENABLE(MEDIA_STREAM) 585 ALWAYS_LOG(LOGIDENTIFIER, userMediaID); 586 551 587 auto completionHandler = [this, userMediaID, frameID, userMediaDocumentOrigin = userMediaDocumentOrigin.copyRef(), topLevelDocumentOrigin = topLevelDocumentOrigin.copyRef()](Optional<bool> originHasPersistentAccess) mutable { 552 588 if (!originHasPersistentAccess) … … 612 648 return; 613 649 650 ALWAYS_LOG(LOGIDENTIFIER, "state was: ", m_captureState, ", is now: ", newState & activeCaptureMask); 614 651 m_captureState = newState & activeCaptureMask; 615 652 … … 623 660 return; 624 661 662 ALWAYS_LOG(LOGIDENTIFIER, "watchdog set to ", interval.value()); 625 663 m_currentWatchdogInterval = interval; 626 664 m_watchdogTimer.startOneShot(m_currentWatchdogInterval); … … 637 675 void UserMediaPermissionRequestManagerProxy::watchdogTimerFired() 638 676 { 677 ALWAYS_LOG(LOGIDENTIFIER); 639 678 m_grantedRequests.clear(); 640 679 m_pregrantedRequests.clear(); … … 643 682 } 644 683 684 #if !RELEASE_LOG_DISABLED 685 WTFLogChannel& UserMediaPermissionRequestManagerProxy::logChannel() const 686 { 687 return WebKit2LogWebRTC; 688 } 689 690 const Logger& UserMediaPermissionRequestManagerProxy::logger() const 691 { 692 return m_page.logger(); 693 } 694 #endif 695 696 String convertEnumerationToString(UserMediaPermissionRequestManagerProxy::RequestAction enumerationValue) 697 { 698 static const NeverDestroyed<String> values[] = { 699 MAKE_STATIC_STRING_IMPL("Deny"), 700 MAKE_STATIC_STRING_IMPL("Grant"), 701 MAKE_STATIC_STRING_IMPL("Prompt"), 702 }; 703 static_assert(static_cast<size_t>(UserMediaPermissionRequestManagerProxy::RequestAction::Deny) == 0, "UserMediaPermissionRequestManagerProxy::RequestAction::Deny is not 0 as expected"); 704 static_assert(static_cast<size_t>(UserMediaPermissionRequestManagerProxy::RequestAction::Grant) == 1, "UserMediaPermissionRequestManagerProxy::RequestAction::Grant is not 1 as expected"); 705 static_assert(static_cast<size_t>(UserMediaPermissionRequestManagerProxy::RequestAction::Prompt) == 2, "UserMediaPermissionRequestManagerProxy::RequestAction::Prompt is not 2 as expected"); 706 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); 707 return values[static_cast<size_t>(enumerationValue)]; 708 } 709 645 710 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h
r242142 r243328 26 26 #include <wtf/CompletionHandler.h> 27 27 #include <wtf/HashMap.h> 28 #include <wtf/LoggerHelper.h> 28 29 #include <wtf/RunLoop.h> 29 30 #include <wtf/Seconds.h> … … 41 42 class WebPageProxy; 42 43 43 class UserMediaPermissionRequestManagerProxy : public CanMakeWeakPtr<UserMediaPermissionRequestManagerProxy> { 44 class UserMediaPermissionRequestManagerProxy 45 : public CanMakeWeakPtr<UserMediaPermissionRequestManagerProxy> 46 #if !RELEASE_LOG_DISABLED 47 , private LoggerHelper 48 #endif 49 { 44 50 public: 45 51 explicit UserMediaPermissionRequestManagerProxy(WebPageProxy&); … … 73 79 void syncWithWebCorePrefs() const; 74 80 81 enum class RequestAction { 82 Deny, 83 Grant, 84 Prompt 85 }; 86 75 87 private: 88 #if !RELEASE_LOG_DISABLED 89 const Logger& logger() const final; 90 const void* logIdentifier() const final { return m_logIdentifier; } 91 const char* logClassName() const override { return "UserMediaPermissionRequestManagerProxy"; } 92 WTFLogChannel& logChannel() const final; 93 #endif 94 76 95 Ref<UserMediaPermissionRequestProxy> createPermissionRequest(uint64_t userMediaID, uint64_t mainFrameID, uint64_t frameID, Ref<WebCore::SecurityOrigin>&& userMediaDocumentOrigin, Ref<WebCore::SecurityOrigin>&& topLevelDocumentOrigin, Vector<WebCore::CaptureDevice>&& audioDevices, Vector<WebCore::CaptureDevice>&& videoDevices, WebCore::MediaStreamRequest&&); 77 96 void denyRequest(uint64_t userMediaID, UserMediaPermissionRequestProxy::UserMediaAccessDenialReason, const String& invalidConstraint); … … 84 103 void getUserMediaPermissionInfo(uint64_t frameID, Ref<WebCore::SecurityOrigin>&& userMediaDocumentOrigin, Ref<WebCore::SecurityOrigin>&& topLevelDocumentOrigin, CompletionHandler<void(Optional<bool>)>&&); 85 104 86 enum class RequestAction {87 Deny,88 Grant,89 Prompt90 };91 105 RequestAction getRequestAction(const UserMediaPermissionRequestProxy&); 92 106 … … 126 140 RunLoop::Timer<UserMediaPermissionRequestManagerProxy> m_watchdogTimer; 127 141 Seconds m_currentWatchdogInterval; 142 #if !RELEASE_LOG_DISABLED 143 Ref<const Logger> m_logger; 144 const void* m_logIdentifier; 145 #endif 128 146 bool m_hasFilteredDeviceList { false }; 129 147 }; 130 148 149 String convertEnumerationToString(UserMediaPermissionRequestManagerProxy::RequestAction); 150 131 151 } // namespace WebKit 132 152 153 #if ENABLE(MEDIA_STREAM) 154 namespace WTF { 155 156 template<typename Type> 157 struct LogArgument; 158 159 template <> 160 struct LogArgument<WebKit::UserMediaPermissionRequestManagerProxy::RequestAction> { 161 static String toString(const WebKit::UserMediaPermissionRequestManagerProxy::RequestAction type) 162 { 163 return convertEnumerationToString(type); 164 } 165 }; 166 167 }; // namespace WTF 168 #endif -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.cpp
r237988 r243328 1 1 /* 2 2 * Copyright (C) 2014 Igalia S.L. 3 * Copyright (C) 2016 Apple Inc. All rights reserved.3 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 137 137 } 138 138 139 String convertEnumerationToString(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason enumerationValue) 140 { 141 static const NeverDestroyed<String> values[] = { 142 MAKE_STATIC_STRING_IMPL("NoConstraints"), 143 MAKE_STATIC_STRING_IMPL("UserMediaDisabled"), 144 MAKE_STATIC_STRING_IMPL("NoCaptureDevices"), 145 MAKE_STATIC_STRING_IMPL("InvalidConstraint"), 146 MAKE_STATIC_STRING_IMPL("HardwareError"), 147 MAKE_STATIC_STRING_IMPL("PermissionDenied"), 148 MAKE_STATIC_STRING_IMPL("OtherFailure"), 149 }; 150 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::NoConstraints) == 0, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::NoConstraints is not 0 as expected"); 151 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::UserMediaDisabled) == 1, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::UserMediaDisabled is not 1 as expected"); 152 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::NoCaptureDevices) == 2, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::NoCaptureDevices is not 2 as expected"); 153 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::InvalidConstraint) == 3, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::InvalidConstraint is not 3 as expected"); 154 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::HardwareError) == 4, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::HardwareError is not 4 as expected"); 155 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied) == 5, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied is not 5 as expected"); 156 static_assert(static_cast<size_t>(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::OtherFailure) == 6, "UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::OtherFailure is not 6 as expected"); 157 ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values)); 158 return values[static_cast<size_t>(enumerationValue)]; 159 } 160 139 161 } // namespace WebKit -
trunk/Source/WebKit/UIProcess/UserMediaPermissionRequestProxy.h
r241270 r243328 1 1 /* 2 2 * Copyright (C) 2014 Igalia S.L. 3 * Copyright (C) 2016 Apple Inc. All rights reserved.3 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 101 101 }; 102 102 103 String convertEnumerationToString(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason); 104 103 105 } // namespace WebKit 106 107 namespace WTF { 108 109 template<typename Type> 110 struct LogArgument; 111 112 template <> 113 struct LogArgument<WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason> { 114 static String toString(const WebKit::UserMediaPermissionRequestProxy::UserMediaAccessDenialReason type) 115 { 116 return convertEnumerationToString(type); 117 } 118 }; 119 120 }; // namespace WTF 121 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r243327 r243328 799 799 m_websiteDataStore = m_process->websiteDataStore(); 800 800 801 if (m_logger) 802 m_logger->setEnabled(this, isAlwaysOnLoggingAllowed()); 803 801 804 ASSERT(!m_drawingArea); 802 805 setDrawingArea(WTFMove(drawingArea)); … … 8947 8950 } 8948 8951 8952 Logger& WebPageProxy::logger() 8953 { 8954 if (!m_logger) { 8955 m_logger = Logger::create(this); 8956 m_logger->setEnabled(this, isAlwaysOnLoggingAllowed()); 8957 } 8958 8959 return *m_logger; 8960 } 8961 8962 void WebPageProxy::configureLoggingChannel(const String& channelName, WTFLogChannelState state, WTFLogLevel level) 8963 { 8964 #if !RELEASE_LOG_DISABLED 8965 auto* channel = getLogChannel(channelName); 8966 if (!channel) 8967 return; 8968 8969 channel->state = state; 8970 channel->level = level; 8971 #else 8972 UNUSED_PARAM(channelName); 8973 UNUSED_PARAM(state); 8974 UNUSED_PARAM(level); 8975 #endif 8976 } 8977 8949 8978 } // namespace WebKit 8950 8979 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r243327 r243328 96 96 #include <wtf/HashMap.h> 97 97 #include <wtf/HashSet.h> 98 #include <wtf/Logger.h> 98 99 #include <wtf/MonotonicTime.h> 99 100 #include <wtf/Optional.h> … … 1501 1502 #endif 1502 1503 1504 void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel); 1505 1503 1506 void addObserver(WebViewDidMoveToWindowObserver&); 1504 1507 void removeObserver(WebViewDidMoveToWindowObserver&); … … 1508 1511 WEBPAGEPROXY_LOADOPTIMIZER_ADDITIONS_1 1509 1512 #endif 1513 1514 Logger& logger(); 1510 1515 1511 1516 // IPC::MessageReceiver … … 2459 2464 2460 2465 HashMap<WebViewDidMoveToWindowObserver*, WeakPtr<WebViewDidMoveToWindowObserver>> m_webViewDidMoveToWindowObservers; 2461 2466 2467 mutable RefPtr<Logger> m_logger; 2468 2462 2469 #if ENABLE(SPEECH_SYNTHESIS) 2463 2470 struct SpeechSynthesisData { -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r243327 r243328 559 559 SpeechSynthesisResume() -> () Async 560 560 #endif 561 562 ConfigureLoggingChannel(String channelName, enum:uint8_t WTFLogChannelState state, enum:uint8_t WTFLogLevel level) 561 563 } -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r243319 r243328 1326 1326 #endif 1327 1327 1328 void WebChromeClient::configureLoggingChannel(const String& channelName, WTFLogChannelState state, WTFLogLevel level) 1329 { 1330 m_page.configureLoggingChannel(channelName, state, level); 1331 } 1332 1328 1333 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r243319 r243328 371 371 #endif 372 372 373 void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel) final; 374 373 375 String m_cachedToolTip; 374 376 mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r243324 r243328 6609 6609 } 6610 6610 6611 void WebPage::configureLoggingChannel(const String& channelName, WTFLogChannelState state, WTFLogLevel level) 6612 { 6613 send(Messages::WebPageProxy::ConfigureLoggingChannel(channelName, state, level)); 6614 } 6615 6611 6616 } // namespace WebKit 6612 6617 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r243326 r243328 1165 1165 void resumeAllMediaBuffering(); 1166 1166 1167 void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel); 1168 1167 1169 #if ENABLE(APPLE_PAY) 1168 1170 WebPaymentCoordinator* paymentCoordinator();
Note: See TracChangeset
for help on using the changeset viewer.