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

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

Issue 1094153002: Move ClosePage() from RenderViewHost to WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on reviews. Created 5 years, 7 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // Close remaining views. 798 // Close remaining views.
799 std::vector<content::RenderFrameHost*> frames_to_close; 799 std::vector<content::RenderFrameHost*> frames_to_close;
800 for (const auto& key_value : all_extension_frames_) { 800 for (const auto& key_value : all_extension_frames_) {
801 if (key_value.second.CanKeepalive() && 801 if (key_value.second.CanKeepalive() &&
802 GetExtensionID(key_value.first) == extension_id) { 802 GetExtensionID(key_value.first) == extension_id) {
803 DCHECK(!key_value.second.has_keepalive); 803 DCHECK(!key_value.second.has_keepalive);
804 frames_to_close.push_back(key_value.first); 804 frames_to_close.push_back(key_value.first);
805 } 805 }
806 } 806 }
807 for (content::RenderFrameHost* frame : frames_to_close) { 807 for (content::RenderFrameHost* frame : frames_to_close) {
808 frame->GetRenderViewHost()->ClosePage(); 808 content::WebContents::FromRenderFrameHost(frame)->ClosePage();
Charlie Reis 2015/04/29 17:31:18 The interstitial CL reminded me that this might re
nasko 2015/04/29 21:15:33 Should we ever be getting a background page RFH th
Charlie Reis 2015/04/29 22:21:48 I hadn't thought of a specific case it could happe
809 // RenderViewHost::ClosePage() may result in calling 809 // WebContents::ClosePage() may result in calling
810 // UnregisterRenderViewHost() asynchronously and may cause race conditions 810 // UnregisterRenderViewHost() asynchronously and may cause race conditions
811 // when the background page is reloaded. 811 // when the background page is reloaded.
812 // To avoid this, unregister the view now. 812 // To avoid this, unregister the view now.
813 UnregisterRenderFrameHost(frame); 813 UnregisterRenderFrameHost(frame);
814 } 814 }
815 815
816 ExtensionHost* host = GetBackgroundHostForExtension(extension_id); 816 ExtensionHost* host = GetBackgroundHostForExtension(extension_id);
817 if (host) 817 if (host)
818 CloseBackgroundHost(host); 818 CloseBackgroundHost(host);
819 } 819 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 if (extension && !IncognitoInfo::IsSplitMode(extension)) { 915 if (extension && !IncognitoInfo::IsSplitMode(extension)) {
916 BrowserContext* original_context = 916 BrowserContext* original_context =
917 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context()); 917 ExtensionsBrowserClient::Get()->GetOriginalContext(browser_context());
918 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url); 918 return ProcessManager::Get(original_context)->GetSiteInstanceForURL(url);
919 } 919 }
920 920
921 return ProcessManager::GetSiteInstanceForURL(url); 921 return ProcessManager::GetSiteInstanceForURL(url);
922 } 922 }
923 923
924 } // namespace extensions 924 } // namespace extensions
OLDNEW
« content/public/browser/web_contents.h ('K') | « content/public/browser/web_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698