Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: extensions/browser/process_manager.cc

Issue 2044643003: Revert of Fix event page process cleanup when running in --isolate-extensions mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/process_manager.h" 5 #include "extensions/browser/process_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 extension_id, 562 extension_id,
563 sequence_id), 563 sequence_id),
564 base::TimeDelta::FromMilliseconds(g_event_page_suspending_time_msec)); 564 base::TimeDelta::FromMilliseconds(g_event_page_suspending_time_msec));
565 } 565 }
566 566
567 void ProcessManager::OnNetworkRequestStarted( 567 void ProcessManager::OnNetworkRequestStarted(
568 content::RenderFrameHost* render_frame_host, 568 content::RenderFrameHost* render_frame_host,
569 uint64_t request_id) { 569 uint64_t request_id) {
570 ExtensionHost* host = GetBackgroundHostForExtension( 570 ExtensionHost* host = GetBackgroundHostForExtension(
571 GetExtensionID(render_frame_host)); 571 GetExtensionID(render_frame_host));
572 if (!host || !IsFrameInExtensionHost(host, render_frame_host)) 572 auto result = pending_network_requests_.insert(request_id);
573 return;
574
575 auto result =
576 pending_network_requests_.insert(std::make_pair(request_id, host));
577 DCHECK(result.second) << "Duplicate network request IDs."; 573 DCHECK(result.second) << "Duplicate network request IDs.";
578 574 if (host && IsFrameInExtensionHost(host, render_frame_host)) {
579 IncrementLazyKeepaliveCount(host->extension()); 575 IncrementLazyKeepaliveCount(host->extension());
580 host->OnNetworkRequestStarted(request_id); 576 host->OnNetworkRequestStarted(request_id);
577 }
581 } 578 }
582 579
583 void ProcessManager::OnNetworkRequestDone( 580 void ProcessManager::OnNetworkRequestDone(
584 content::RenderFrameHost* render_frame_host, 581 content::RenderFrameHost* render_frame_host,
585 uint64_t request_id) { 582 uint64_t request_id) {
586 auto result = pending_network_requests_.find(request_id); 583 ExtensionHost* host = GetBackgroundHostForExtension(
587 if (result == pending_network_requests_.end()) 584 GetExtensionID(render_frame_host));
588 return; 585 if (host && IsFrameInExtensionHost(host, render_frame_host)) {
589 586 host->OnNetworkRequestDone(request_id);
590 // The cached |host| can be invalid, if it was deleted between the time it 587 if (pending_network_requests_.erase(request_id))
591 // was inserted in the map and the look up. It is checked to ensure it is in 588 DecrementLazyKeepaliveCount(host->extension());
592 // the list of existing background_hosts_. 589 }
593 ExtensionHost* host = result->second;
594 pending_network_requests_.erase(result);
595
596 if (background_hosts_.find(host) == background_hosts_.end())
597 return;
598
599 DCHECK(IsFrameInExtensionHost(host, render_frame_host));
600
601 host->OnNetworkRequestDone(request_id);
602 DecrementLazyKeepaliveCount(host->extension());
603 } 590 }
604 591
605 void ProcessManager::CancelSuspend(const Extension* extension) { 592 void ProcessManager::CancelSuspend(const Extension* extension) {
606 bool& is_closing = background_page_data_[extension->id()].is_closing; 593 bool& is_closing = background_page_data_[extension->id()].is_closing;
607 ExtensionHost* host = GetBackgroundHostForExtension(extension->id()); 594 ExtensionHost* host = GetBackgroundHostForExtension(extension->id());
608 if (host && is_closing) { 595 if (host && is_closing) {
609 is_closing = false; 596 is_closing = false;
610 host->render_process_host()->Send( 597 host->render_process_host()->Send(
611 new ExtensionMsg_CancelSuspend(extension->id())); 598 new ExtensionMsg_CancelSuspend(extension->id()));
612 // This increment / decrement is to simulate an instantaneous event. This 599 // This increment / decrement is to simulate an instantaneous event. This
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 977 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
991 BrowserContext* original_context = 978 BrowserContext* original_context =
992 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); 979 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context());
993 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 980 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
994 } 981 }
995 982
996 return ProcessManager::GetSiteInstanceForURL(url); 983 return ProcessManager::GetSiteInstanceForURL(url);
997 } 984 }
998 985
999 } // namespace extensions 986 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698