Changeset 172660 in webkit
- Timestamp:
- Aug 15, 2014, 4:56:57 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r172653 r172660 1 2014-08-15 Alexey Proskuryakov <ap@apple.com> 2 3 Improve page to process relationship tracking 4 https://bugs.webkit.org/show_bug.cgi?id=135996 5 <rdar://problem/16991213> 6 7 Reviewed by Sam Weinig. 8 9 * UIProcess/VisitedLinkProvider.cpp: 10 (WebKit::VisitedLinkProvider::removeAll): 11 (WebKit::VisitedLinkProvider::pendingVisitedLinksTimerFired): 12 (WebKit::VisitedLinkProvider::sendTable): 13 Added assertions for m_processes only having valid entries. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::reattachToWebProcess): When attaching to a new process, 17 tell the old process that the page is not longer associated with it, avoiding 18 a potential stale pointer. 19 If re-attached to an existing process, make sure that we perform all the same 20 registrations as after having launched a new process. This substantially improves 21 the behavior when the number of open tabs is over process limit. 22 (WebKit::WebPageProxy::reattachToWebProcessWithItem): Added ASSERT(!isValid()) 23 to avoid confusion. All other calls to reattachToWebProcess() have this as a 24 runtime check, but reattachToWebProcessWithItem() is only called for valid pages. 25 (WebKit::WebPageProxy::terminateProcess): Added an assertion with a FIXME for 26 something that will need to be fixed another day. 27 28 * UIProcess/WebPageProxy.h: Removed an unimplemented function. 29 30 * UIProcess/WebProcessProxy.cpp: 31 (WebKit::WebProcessProxy::addExistingWebPage): Added assertions for page map sanity. 32 (WebKit::WebProcessProxy::removeWebPage): Added a check for page state being Terminated 33 already. This avoids an assertion failure that happened under the new call to 34 removeWebPage() in reattachToWebProcess(), as we are now calling it for terminated 35 processes that are not in WebContext::m_processes any more. 36 (WebKit::WebProcessProxy::didFinishLaunching): Added an assertion that page agrees 37 about using this process. 38 1 39 2014-08-15 Gavin Barraclough <barraclough@apple.com> 2 40 -
trunk/Source/WebKit2/UIProcess/VisitedLinkProvider.cpp
r168317 r172660 98 98 m_table.clear(); 99 99 100 for (auto& processAndCount : m_processes) 101 processAndCount.key->connection()->send(Messages::VisitedLinkTableController::RemoveAllVisitedLinks(), m_identifier); 100 for (auto& processAndCount : m_processes) { 101 WebProcessProxy* process = processAndCount.key; 102 ASSERT(process->context().processes().contains(process)); 103 process->connection()->send(Messages::VisitedLinkTableController::RemoveAllVisitedLinks(), m_identifier); 104 } 102 105 } 103 106 … … 176 179 177 180 for (auto& processAndCount : m_processes) { 181 WebProcessProxy* process = processAndCount.key; 182 ASSERT(process->context().processes().contains(process)); 183 178 184 if (addedVisitedLinks.size() > 20) 179 process AndCount.key->connection()->send(Messages::VisitedLinkTableController::AllVisitedLinkStateChanged(), m_identifier);185 process->connection()->send(Messages::VisitedLinkTableController::AllVisitedLinkStateChanged(), m_identifier); 180 186 else 181 process AndCount.key->connection()->send(Messages::VisitedLinkTableController::VisitedLinkStateChanged(addedVisitedLinks), m_identifier);187 process->connection()->send(Messages::VisitedLinkTableController::VisitedLinkStateChanged(addedVisitedLinks), m_identifier); 182 188 } 183 189 } … … 230 236 void VisitedLinkProvider::sendTable(WebProcessProxy& process) 231 237 { 238 ASSERT(process.context().processes().contains(&process)); 239 232 240 SharedMemory::Handle handle; 233 241 if (!m_table.sharedMemory()->createHandle(handle, SharedMemory::ReadOnly)) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r172635 r172660 546 546 547 547 m_isValid = true; 548 m_process->removeWebPage(m_pageID); 548 549 549 550 if (m_process->context().processModel() == ProcessModelSharedSecondaryProcess) … … 551 552 else 552 553 m_process = m_process->context().createNewWebProcessRespectingProcessCountLimit(); 554 555 ASSERT(m_process->state() != ChildProcessProxy::State::Terminated); 556 if (m_process->state() == ChildProcessProxy::State::Running) 557 processDidFinishLaunching(); 553 558 m_process->addExistingWebPage(this, m_pageID); 554 559 m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this); … … 580 585 if (item && item != m_backForwardList->currentItem()) 581 586 m_backForwardList->goToItem(item); 582 587 588 ASSERT(!isValid()); 583 589 reattachToWebProcess(); 584 590 … … 1866 1872 void WebPageProxy::terminateProcess() 1867 1873 { 1874 // requestTermination() is a no-op for launching processes, so we get into an inconsistent state by calling resetStateAfterProcessExited(). 1875 // FIXME: A client can terminate the page at any time, so we should do something more meaningful than assert and fall apart in release builds. 1876 ASSERT(m_process->state() != WebProcessProxy::State::Launching); 1877 1868 1878 // NOTE: This uses a check of m_isValid rather than calling isValid() since 1869 1879 // we want this to run even for pages being closed or that already closed. -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r172635 r172660 741 741 bool isValid() const; 742 742 743 PassRefPtr<API::Array> relatedPages() const;744 745 743 const String& urlAtProcessExit() const { return m_urlAtProcessExit; } 746 744 FrameLoadState::State loadStateAtProcessExit() const { return m_loadStateAtProcessExit; } -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r170902 r172660 187 187 void WebProcessProxy::addExistingWebPage(WebPageProxy* webPage, uint64_t pageID) 188 188 { 189 ASSERT(!m_pageMap.contains(pageID)); 190 ASSERT(!globalPageMap().contains(pageID)); 191 189 192 m_pageMap.set(pageID, webPage); 190 193 globalPageMap().set(pageID, webPage); … … 216 219 // If this was the last WebPage open in that web process, and we have no other reason to keep it alive, let it go. 217 220 // We only allow this when using a network process, as otherwise the WebProcess needs to preserve its session state. 218 if (!m_context->usesNetworkProcess() || !canTerminateChildProcess())221 if (!m_context->usesNetworkProcess() || state() == State::Terminated || !canTerminateChildProcess()) 219 222 return; 220 223 … … 472 475 ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier); 473 476 474 for (auto& page : m_pageMap.values()) 477 for (WebPageProxy* page : m_pageMap.values()) { 478 ASSERT(this == &page->process()); 475 479 page->processDidFinishLaunching(); 480 } 476 481 477 482 m_webConnection = WebConnectionToWebProcess::create(this);
Note:
See TracChangeset
for help on using the changeset viewer.