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

Side by Side Diff: chrome/browser/renderer_host/cross_site_resource_handler.cc

Issue 353015: Last patch in removing MessageLoop* caching. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <string> 5 #include <string>
6 6
7 #include "chrome/browser/renderer_host/cross_site_resource_handler.h" 7 #include "chrome/browser/renderer_host/cross_site_resource_handler.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "chrome/browser/chrome_thread.h"
11 #include "chrome/browser/renderer_host/render_view_host.h" 11 #include "chrome/browser/renderer_host/render_view_host.h"
12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
13 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" 13 #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 15
16 namespace { 16 namespace {
17 17
18 // Task to notify the TabContents that a cross-site response has begun, so that 18 // Task to notify the TabContents that a cross-site response has begun, so that
19 // TabContents can tell the old page to run its onunload handler. 19 // TabContents can tell the old page to run its onunload handler.
20 class CrossSiteNotifyTask : public Task { 20 class CrossSiteNotifyTask : public Task {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // We've already completed the transition, so just pass it through. 154 // We've already completed the transition, so just pass it through.
155 return next_handler_->OnResponseCompleted(request_id, status, 155 return next_handler_->OnResponseCompleted(request_id, status,
156 security_info); 156 security_info);
157 } else { 157 } else {
158 // Some types of failures will call OnResponseCompleted without calling 158 // Some types of failures will call OnResponseCompleted without calling
159 // CrossSiteResourceHandler::OnResponseStarted. 159 // CrossSiteResourceHandler::OnResponseStarted.
160 if (status.status() == URLRequestStatus::CANCELED) { 160 if (status.status() == URLRequestStatus::CANCELED) {
161 // Here the request was canceled, which happens when selecting "take me 161 // Here the request was canceled, which happens when selecting "take me
162 // back" from an interstitial. Nothing to do but cancel the pending 162 // back" from an interstitial. Nothing to do but cancel the pending
163 // render view host. 163 // render view host.
164 CancelPendingRenderViewTask* task = 164 ChromeThread::PostTask(
165 new CancelPendingRenderViewTask(render_process_host_id_, 165 ChromeThread::UI, FROM_HERE,
166 render_view_id_); 166 new CancelPendingRenderViewTask(
167 rdh_->ui_loop()->PostTask(FROM_HERE, task); 167 render_process_host_id_, render_view_id_));
168 return next_handler_->OnResponseCompleted(request_id, status, 168 return next_handler_->OnResponseCompleted(request_id, status,
169 security_info); 169 security_info);
170 } else { 170 } else {
171 // An error occured, we should wait now for the cross-site transition, 171 // An error occured, we should wait now for the cross-site transition,
172 // so that the error message (e.g., 404) can be displayed to the user. 172 // so that the error message (e.g., 404) can be displayed to the user.
173 // Also continue with the logic below to remember that we completed 173 // Also continue with the logic below to remember that we completed
174 // during the cross-site transition. 174 // during the cross-site transition.
175 ResourceDispatcherHost::GlobalRequestID global_id( 175 ResourceDispatcherHost::GlobalRequestID global_id(
176 render_process_host_id_, request_id); 176 render_process_host_id_, request_id);
177 StartCrossSiteTransition(request_id, NULL, global_id); 177 StartCrossSiteTransition(request_id, NULL, global_id);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // renderer is ready. 259 // renderer is ready.
260 rdh_->PauseRequest(render_process_host_id_, request_id, true); 260 rdh_->PauseRequest(render_process_host_id_, request_id, true);
261 } 261 }
262 // If our OnResponseStarted wasn't called, then we're being called by 262 // If our OnResponseStarted wasn't called, then we're being called by
263 // OnResponseCompleted after a failure. We don't need to pause, because 263 // OnResponseCompleted after a failure. We don't need to pause, because
264 // there will be no reads. 264 // there will be no reads.
265 265
266 // Tell the tab responsible for this request that a cross-site response is 266 // Tell the tab responsible for this request that a cross-site response is
267 // starting, so that it can tell its old renderer to run its onunload 267 // starting, so that it can tell its old renderer to run its onunload
268 // handler now. We will wait to hear the corresponding ClosePage_ACK. 268 // handler now. We will wait to hear the corresponding ClosePage_ACK.
269 CrossSiteNotifyTask* task = 269 ChromeThread::PostTask(
270 new CrossSiteNotifyTask(render_process_host_id_, 270 ChromeThread::UI, FROM_HERE,
271 render_view_id_, 271 new CrossSiteNotifyTask(
272 request_id); 272 render_process_host_id_, render_view_id_, request_id));
273 rdh_->ui_loop()->PostTask(FROM_HERE, task);
274 } 273 }
OLDNEW
« no previous file with comments | « chrome/browser/privacy_blacklist/blacklist_observer.cc ('k') | chrome/browser/renderer_host/database_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698