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

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

Issue 2028873002: Fix event page process cleanup when running in --isolate-extensions mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup empty lines and formatting. 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
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 auto result = pending_network_requests_.insert(request_id); 572 if (!host)
573 return;
574
575 auto result = pending_network_requests_.insert(
576 make_pair(request_id, host->extension()->id()));
Devlin 2016/05/31 22:45:30 unrelated - why doesn't make_pair need the std:: s
nasko 2016/06/01 21:22:19 Done.
573 DCHECK(result.second) << "Duplicate network request IDs."; 577 DCHECK(result.second) << "Duplicate network request IDs.";
574 if (host && IsFrameInExtensionHost(host, render_frame_host)) { 578
579 if (IsFrameInExtensionHost(host, render_frame_host)) {
575 IncrementLazyKeepaliveCount(host->extension()); 580 IncrementLazyKeepaliveCount(host->extension());
576 host->OnNetworkRequestStarted(request_id); 581 host->OnNetworkRequestStarted(request_id);
577 } 582 }
578 } 583 }
579 584
580 void ProcessManager::OnNetworkRequestDone( 585 void ProcessManager::OnNetworkRequestDone(
581 content::RenderFrameHost* render_frame_host, 586 content::RenderFrameHost* render_frame_host,
582 uint64_t request_id) { 587 uint64_t request_id) {
583 ExtensionHost* host = GetBackgroundHostForExtension( 588 ExtensionHost* host = GetBackgroundHostForExtension(
584 GetExtensionID(render_frame_host)); 589 GetExtensionID(render_frame_host));
585 if (host && IsFrameInExtensionHost(host, render_frame_host)) { 590 if (host && IsFrameInExtensionHost(host, render_frame_host))
586 host->OnNetworkRequestDone(request_id); 591 host->OnNetworkRequestDone(request_id);
Devlin 2016/05/31 22:45:30 Are we going to have the same problem here with on
nasko 2016/06/01 21:22:19 There were a bunch of problems with this version o
587 if (pending_network_requests_.erase(request_id)) 592
588 DecrementLazyKeepaliveCount(host->extension()); 593 auto result = pending_network_requests_.find(request_id);
589 } 594 if (result == pending_network_requests_.end())
595 return;
596
597 DecrementLazyKeepaliveCount(result->second);
598 pending_network_requests_.erase(request_id);
590 } 599 }
591 600
592 void ProcessManager::CancelSuspend(const Extension* extension) { 601 void ProcessManager::CancelSuspend(const Extension* extension) {
593 bool& is_closing = background_page_data_[extension->id()].is_closing; 602 bool& is_closing = background_page_data_[extension->id()].is_closing;
594 ExtensionHost* host = GetBackgroundHostForExtension(extension->id()); 603 ExtensionHost* host = GetBackgroundHostForExtension(extension->id());
595 if (host && is_closing) { 604 if (host && is_closing) {
596 is_closing = false; 605 is_closing = false;
597 host->render_process_host()->Send( 606 host->render_process_host()->Send(
598 new ExtensionMsg_CancelSuspend(extension->id())); 607 new ExtensionMsg_CancelSuspend(extension->id()));
599 // This increment / decrement is to simulate an instantaneous event. This 608 // This increment / decrement is to simulate an instantaneous event. This
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 986 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
978 BrowserContext* original_context = 987 BrowserContext* original_context =
979 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); 988 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context());
980 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 989 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
981 } 990 }
982 991
983 return ProcessManager::GetSiteInstanceForURL(url); 992 return ProcessManager::GetSiteInstanceForURL(url);
984 } 993 }
985 994
986 } // namespace extensions 995 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698