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

Side by Side Diff: extensions/browser/app_window/app_window_contents.cc

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 11 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/app_window/app_window_contents.h" 5 #include "extensions/browser/app_window/app_window_contents.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/loader_io_thread_notifier.h"
12 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/resource_dispatcher_host.h" 16 #include "content/public/browser/resource_dispatcher_host.h"
16 #include "content/public/browser/site_instance.h" 17 #include "content/public/browser/site_instance.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/renderer_preferences.h" 19 #include "content/public/common/renderer_preferences.h"
19 #include "extensions/browser/app_window/native_app_window.h" 20 #include "extensions/browser/app_window/native_app_window.h"
20 #include "extensions/common/extension_messages.h" 21 #include "extensions/common/extension_messages.h"
21 22
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 content::RenderFrameHost* rfh = web_contents_->GetMainFrame(); 83 content::RenderFrameHost* rfh = web_contents_->GetMainFrame();
83 rfh->Send(new ExtensionMsg_MessageInvoke( 84 rfh->Send(new ExtensionMsg_MessageInvoke(
84 rfh->GetRoutingID(), host_->extension_id(), "app.window", 85 rfh->GetRoutingID(), host_->extension_id(), "app.window",
85 "appWindowShownForTests", args, false)); 86 "appWindowShownForTests", args, false));
86 } 87 }
87 88
88 void AppWindowContentsImpl::OnWindowReady() { 89 void AppWindowContentsImpl::OnWindowReady() {
89 is_window_ready_ = true; 90 is_window_ready_ = true;
90 if (is_blocking_requests_) { 91 if (is_blocking_requests_) {
91 is_blocking_requests_ = false; 92 is_blocking_requests_ = false;
92 content::RenderFrameHost* frame = web_contents_->GetMainFrame(); 93 content::LoaderIOThreadNotifier::ResumeBlockedRequestsForFrame(
93 content::BrowserThread::PostTask( 94 web_contents_->GetMainFrame());
94 content::BrowserThread::IO, FROM_HERE,
95 base::Bind(
96 &content::ResourceDispatcherHost::ResumeBlockedRequestsForRoute,
97 base::Unretained(content::ResourceDispatcherHost::Get()),
98 frame->GetProcess()->GetID(),
99 frame->GetRenderViewHost()->GetRoutingID()));
100 } 95 }
101 } 96 }
102 97
103 content::WebContents* AppWindowContentsImpl::GetWebContents() const { 98 content::WebContents* AppWindowContentsImpl::GetWebContents() const {
104 return web_contents_.get(); 99 return web_contents_.get();
105 } 100 }
106 101
107 WindowController* AppWindowContentsImpl::GetWindowController() const { 102 WindowController* AppWindowContentsImpl::GetWindowController() const {
108 return nullptr; 103 return nullptr;
109 } 104 }
(...skipping 19 matching lines...) Expand all
129 host_->UpdateDraggableRegions(regions); 124 host_->UpdateDraggableRegions(regions);
130 } 125 }
131 126
132 void AppWindowContentsImpl::SuspendRenderFrameHost( 127 void AppWindowContentsImpl::SuspendRenderFrameHost(
133 content::RenderFrameHost* rfh) { 128 content::RenderFrameHost* rfh) {
134 DCHECK(rfh); 129 DCHECK(rfh);
135 // Don't bother blocking requests if the renderer side is already good to go. 130 // Don't bother blocking requests if the renderer side is already good to go.
136 if (is_window_ready_) 131 if (is_window_ready_)
137 return; 132 return;
138 is_blocking_requests_ = true; 133 is_blocking_requests_ = true;
139 // The ResourceDispatcherHost only accepts RenderViewHost child ids. 134 content::LoaderIOThreadNotifier::BlockRequestsForFrame(rfh);
nasko 2016/01/07 00:43:09 Can we stick those methods on an existing class th
Charlie Harrison 2016/01/07 22:47:06 Yeah, I think I'll merge the LoaderIOThreadNotifie
140 // TODO(devlin): This will need to change for site isolation.
141 content::BrowserThread::PostTask(
142 content::BrowserThread::IO, FROM_HERE,
143 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute,
144 base::Unretained(content::ResourceDispatcherHost::Get()),
145 rfh->GetProcess()->GetID(),
146 rfh->GetRenderViewHost()->GetRoutingID()));
147 } 135 }
148 136
149 } // namespace extensions 137 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698