Changeset 82856 in webkit
- Timestamp:
- Apr 4, 2011 12:40:47 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
r75907 r82856 2064 2064 *(NPBool *)value = FALSE; 2065 2065 #else 2066 *(NPBool *)value = TRUE;2066 *(NPBool *)value = FALSE; 2067 2067 #endif 2068 2068 return NPERR_NO_ERROR; -
trunk/Source/WebKit2/ChangeLog
r82854 r82856 1 2011-04-04 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Make it easier to send a message to all processes in a context 6 https://bugs.webkit.org/show_bug.cgi?id=57776 7 8 Add WebContext::sendToAllProcesses and WebContext::sendToAllProcessesRelaunchingThemIfNecessary 9 as a first step towards getting rid of WebContext::process() and getting rid of a class of crashers 10 where WebContext::process() is null. 11 12 * UIProcess/WebContext.cpp: 13 (WebKit::WebContext::initializeHistoryClient): 14 (WebKit::WebContext::languageChanged): 15 (WebKit::WebContext::setAlwaysUsesComplexTextCodePath): 16 (WebKit::WebContext::registerURLSchemeAsEmptyDocument): 17 (WebKit::WebContext::registerURLSchemeAsSecure): 18 (WebKit::WebContext::setDomainRelaxationForbiddenForURLScheme): 19 (WebKit::WebContext::setCacheModel): 20 (WebKit::WebContext::setDefaultRequestTimeoutInterval): 21 (WebKit::WebContext::clearResourceCaches): 22 (WebKit::WebContext::clearApplicationCache): 23 (WebKit::WebContext::setEnhancedAccessibility): 24 (WebKit::WebContext::startMemorySampler): 25 Use sendToAllProcesses. 26 27 (WebKit::WebContext::stopMemorySampler): 28 Use sendToAllProcesses. This is a slight policy change where we now create a sandbox extension even 29 if there's no process around. Since this is a debugging tool it seems OK to do this. 30 31 * UIProcess/WebContext.h: 32 Get rid of hasValidProcess. 33 34 (WebKit::WebContext::sendToAllProcesses): 35 If we have a process and we can send messages to it, then do so. 36 37 (WebKit::WebContext::sendToAllProcessesRelaunchingThemIfNecessary): 38 Relaunch the web process and send the message. 39 40 * UIProcess/WebCookieManagerProxy.cpp: 41 (WebKit::WebCookieManagerProxy::deleteCookiesForHostname): 42 (WebKit::WebCookieManagerProxy::deleteAllCookies): 43 (WebKit::WebCookieManagerProxy::startObservingCookieChanges): 44 (WebKit::WebCookieManagerProxy::stopObservingCookieChanges): 45 (WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy): 46 Use sendToAllProcesses and sendToAllProcessesRelaunchingThemIfNecessary. 47 1 48 2011-04-04 Adam Roben <aroben@apple.com> 2 49 -
trunk/Source/WebKit2/UIProcess/WebContext.cpp
r82458 r82856 194 194 { 195 195 m_historyClient.initialize(client); 196 197 if (!hasValidProcess()) 198 return; 199 200 m_process->send(Messages::WebProcess::SetShouldTrackVisitedLinks(m_historyClient.shouldTrackVisitedLinks()), 0); 196 197 sendToAllProcesses(Messages::WebProcess::SetShouldTrackVisitedLinks(m_historyClient.shouldTrackVisitedLinks())); 201 198 } 202 199 … … 213 210 void WebContext::languageChanged() 214 211 { 215 if (!hasValidProcess()) 216 return; 217 218 m_process->send(Messages::WebProcess::LanguageChanged(defaultLanguage()), 0); 212 sendToAllProcesses(Messages::WebProcess::LanguageChanged(defaultLanguage())); 219 213 } 220 214 … … 464 458 { 465 459 m_alwaysUsesComplexTextCodePath = alwaysUseComplexText; 466 467 if (!hasValidProcess()) 468 return; 469 470 m_process->send(Messages::WebProcess::SetAlwaysUsesComplexTextCodePath(alwaysUseComplexText), 0); 460 sendToAllProcesses(Messages::WebProcess::SetAlwaysUsesComplexTextCodePath(alwaysUseComplexText)); 471 461 } 472 462 … … 474 464 { 475 465 m_schemesToRegisterAsEmptyDocument.add(urlScheme); 476 477 if (!hasValidProcess()) 478 return; 479 480 m_process->send(Messages::WebProcess::RegisterURLSchemeAsEmptyDocument(urlScheme), 0); 466 sendToAllProcesses(Messages::WebProcess::RegisterURLSchemeAsEmptyDocument(urlScheme)); 481 467 } 482 468 … … 484 470 { 485 471 m_schemesToRegisterAsSecure.add(urlScheme); 486 487 if (!hasValidProcess()) 488 return; 489 490 m_process->send(Messages::WebProcess::RegisterURLSchemeAsSecure(urlScheme), 0); 472 sendToAllProcesses(Messages::WebProcess::RegisterURLSchemeAsSecure(urlScheme)); 491 473 } 492 474 … … 494 476 { 495 477 m_schemesToSetDomainRelaxationForbiddenFor.add(urlScheme); 496 497 if (!hasValidProcess()) 498 return; 499 500 m_process->send(Messages::WebProcess::SetDomainRelaxationForbiddenForURLScheme(urlScheme), 0); 478 sendToAllProcesses(Messages::WebProcess::SetDomainRelaxationForbiddenForURLScheme(urlScheme)); 501 479 } 502 480 … … 504 482 { 505 483 m_cacheModel = cacheModel; 506 507 if (!hasValidProcess()) 508 return; 509 m_process->send(Messages::WebProcess::SetCacheModel(static_cast<uint32_t>(m_cacheModel)), 0); 484 sendToAllProcesses(Messages::WebProcess::SetCacheModel(static_cast<uint32_t>(m_cacheModel))); 510 485 } 511 486 512 487 void WebContext::setDefaultRequestTimeoutInterval(double timeoutInterval) 513 488 { 514 if (!hasValidProcess()) 515 return; 516 517 m_process->send(Messages::WebProcess::SetDefaultRequestTimeoutInterval(timeoutInterval), 0); 489 sendToAllProcesses(Messages::WebProcess::SetDefaultRequestTimeoutInterval(timeoutInterval)); 518 490 } 519 491 … … 703 675 void WebContext::clearResourceCaches(ResourceCachesToClear cachesToClear) 704 676 { 705 if (hasValidProcess()) { 706 m_process->send(Messages::WebProcess::ClearResourceCaches(cachesToClear), 0); 707 return; 708 } 677 if (sendToAllProcesses(Messages::WebProcess::ClearResourceCaches(cachesToClear))) 678 return; 709 679 710 680 if (cachesToClear == InMemoryResourceCachesOnly) … … 719 689 void WebContext::clearApplicationCache() 720 690 { 721 if (!hasValidProcess()) { 722 // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to 723 // clear the application cache will be respected. But if the user quits the application before another WebProcess is created, 724 // their request will be ignored. 725 m_clearApplicationCacheForNewWebProcess = true; 726 return; 727 } 728 729 m_process->send(Messages::WebProcess::ClearApplicationCache(), 0); 691 if (sendToAllProcesses(Messages::WebProcess::ClearApplicationCache())) 692 return; 693 694 // FIXME <rdar://problem/8727879>: Setting this flag ensures that the next time a WebProcess is created, this request to 695 // clear the application cache will be respected. But if the user quits the application before another WebProcess is created, 696 // their request will be ignored. 697 m_clearApplicationCacheForNewWebProcess = true; 730 698 } 731 699 732 700 void WebContext::setEnhancedAccessibility(bool flag) 733 701 { 734 if (!hasValidProcess()) 735 return; 736 737 m_process->send(Messages::WebProcess::SetEnhancedAccessibility(flag), 0); 702 sendToAllProcesses(Messages::WebProcess::SetEnhancedAccessibility(flag)); 738 703 } 739 704 … … 749 714 #endif 750 715 751 if (!hasValidProcess())752 return;753 754 716 // For WebProcess 755 717 SandboxExtension::Handle sampleLogSandboxHandle; … … 758 720 sampleLogFilePath = SandboxExtension::createHandleForTemporaryFile(sampleLogFilePath, SandboxExtension::WriteOnly, sampleLogSandboxHandle); 759 721 760 m_process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, interval), 0);722 sendToAllProcesses(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, interval)); 761 723 } 762 724 … … 770 732 WebMemorySampler::shared()->stop(); 771 733 #endif 772 773 if (!hasValidProcess()) 774 return; 775 776 m_process->send(Messages::WebProcess::StopMemorySampler(), 0); 734 735 sendToAllProcesses(Messages::WebProcess::StopMemorySampler()); 777 736 } 778 737 -
trunk/Source/WebKit2/UIProcess/WebContext.h
r81997 r82856 76 76 ProcessModel processModel() const { return m_processModel; } 77 77 WebProcessProxy* process() const { return m_process.get(); } 78 bool hasValidProcess() const { return m_process && m_process->isValid(); } 79 78 79 template<typename U> bool sendToAllProcesses(const U& message); 80 template<typename U> bool sendToAllProcessesRelaunchingThemIfNecessary(const U& message); 81 80 82 void processDidFinishLaunching(WebProcessProxy*); 81 83 … … 206 208 String localStorageDirectory() const; 207 209 String platformDefaultLocalStorageDirectory() const; 208 210 209 211 ProcessModel m_processModel; 210 212 … … 266 268 }; 267 269 270 template<typename U> inline bool WebContext::sendToAllProcesses(const U& message) 271 { 272 if (!m_process || !m_process->canSendMessage()) 273 return false; 274 275 return m_process->send(message, 0); 276 } 277 278 template<typename U> bool WebContext::sendToAllProcessesRelaunchingThemIfNecessary(const U& message) 279 { 280 relaunchProcessIfNecessary(); 281 282 return m_process->send(message, 0); 283 } 284 268 285 } // namespace WebKit 269 286 -
trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
r82458 r82856 101 101 { 102 102 ASSERT(m_webContext); 103 m_webContext->relaunchProcessIfNecessary(); 104 m_webContext->process()->send(Messages::WebCookieManager::DeleteCookiesForHostname(hostname), 0); 103 m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::DeleteCookiesForHostname(hostname)); 105 104 } 106 105 … … 108 107 { 109 108 ASSERT(m_webContext); 110 m_webContext->relaunchProcessIfNecessary(); 111 m_webContext->process()->send(Messages::WebCookieManager::DeleteAllCookies(), 0); 109 m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::DeleteAllCookies()); 112 110 } 113 111 … … 115 113 { 116 114 ASSERT(m_webContext); 117 m_webContext->relaunchProcessIfNecessary(); 118 m_webContext->process()->send(Messages::WebCookieManager::StartObservingCookieChanges(), 0); 115 m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::StartObservingCookieChanges()); 119 116 } 120 117 … … 122 119 { 123 120 ASSERT(m_webContext); 124 if (!m_webContext->hasValidProcess()) 125 return; 126 m_webContext->process()->send(Messages::WebCookieManager::StopObservingCookieChanges(), 0); 121 m_webContext->sendToAllProcesses(Messages::WebCookieManager::StopObservingCookieChanges()); 127 122 } 128 123 … … 135 130 { 136 131 ASSERT(m_webContext); 137 m_webContext->relaunchProcessIfNecessary();138 132 #if PLATFORM(MAC) 139 133 persistHTTPCookieAcceptPolicy(policy); 140 134 #endif 141 m_webContext->process()->send(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy), 0); 135 136 m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy)); 142 137 } 143 138
Note: See TracChangeset
for help on using the changeset viewer.