OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/loader/cross_site_resource_handler.h" | 5 #include "content/browser/loader/cross_site_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 // Defer to tell RDH not to notify the world or clean up the pending request. | 287 // Defer to tell RDH not to notify the world or clean up the pending request. |
288 // We will do so in ResumeResponse. | 288 // We will do so in ResumeResponse. |
289 *defer = true; | 289 *defer = true; |
290 OnDidDefer(); | 290 OnDidDefer(); |
291 } | 291 } |
292 | 292 |
293 // We can now send the response to the new renderer, which will cause | 293 // We can now send the response to the new renderer, which will cause |
294 // WebContentsImpl to swap in the new renderer and destroy the old one. | 294 // WebContentsImpl to swap in the new renderer and destroy the old one. |
295 void CrossSiteResourceHandler::ResumeResponse() { | 295 void CrossSiteResourceHandler::ResumeResponse() { |
| 296 TRACE_EVENT_ASYNC_END0( |
| 297 "navigation", "CrossSiteResourceHandler transition", this); |
296 DCHECK(request()); | 298 DCHECK(request()); |
297 in_cross_site_transition_ = false; | 299 in_cross_site_transition_ = false; |
298 ResourceRequestInfoImpl* info = GetRequestInfo(); | 300 ResourceRequestInfoImpl* info = GetRequestInfo(); |
299 | 301 |
300 if (has_started_response_) { | 302 if (has_started_response_) { |
301 // Send OnResponseStarted to the new renderer. | 303 // Send OnResponseStarted to the new renderer. |
302 DCHECK(response_.get()); | 304 DCHECK(response_.get()); |
303 bool defer = false; | 305 bool defer = false; |
304 if (!next_handler_->OnResponseStarted(response_.get(), &defer)) { | 306 if (!next_handler_->OnResponseStarted(response_.get(), &defer)) { |
305 controller()->Cancel(); | 307 controller()->Cancel(); |
(...skipping 21 matching lines...) Expand all Loading... |
327 | 329 |
328 // static | 330 // static |
329 void CrossSiteResourceHandler::SetLeakRequestsForTesting( | 331 void CrossSiteResourceHandler::SetLeakRequestsForTesting( |
330 bool leak_requests_for_testing) { | 332 bool leak_requests_for_testing) { |
331 leak_requests_for_testing_ = leak_requests_for_testing; | 333 leak_requests_for_testing_ = leak_requests_for_testing; |
332 } | 334 } |
333 | 335 |
334 // Prepare to transfer the response to a new RenderFrameHost. | 336 // Prepare to transfer the response to a new RenderFrameHost. |
335 void CrossSiteResourceHandler::StartCrossSiteTransition( | 337 void CrossSiteResourceHandler::StartCrossSiteTransition( |
336 ResourceResponse* response) { | 338 ResourceResponse* response) { |
| 339 TRACE_EVENT_ASYNC_BEGIN0( |
| 340 "navigation", "CrossSiteResourceHandler transition", this); |
337 in_cross_site_transition_ = true; | 341 in_cross_site_transition_ = true; |
338 response_ = response; | 342 response_ = response; |
339 | 343 |
340 // Store this handler on the ExtraRequestInfo, so that RDH can call our | 344 // Store this handler on the ExtraRequestInfo, so that RDH can call our |
341 // ResumeResponse method when we are ready to resume. | 345 // ResumeResponse method when we are ready to resume. |
342 ResourceRequestInfoImpl* info = GetRequestInfo(); | 346 ResourceRequestInfoImpl* info = GetRequestInfo(); |
343 info->set_cross_site_handler(this); | 347 info->set_cross_site_handler(this); |
344 | 348 |
345 GlobalRequestID global_id(info->GetChildID(), info->GetRequestID()); | 349 GlobalRequestID global_id(info->GetChildID(), info->GetRequestID()); |
346 | 350 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 controller()->Resume(); | 416 controller()->Resume(); |
413 } | 417 } |
414 } | 418 } |
415 | 419 |
416 void CrossSiteResourceHandler::OnDidDefer() { | 420 void CrossSiteResourceHandler::OnDidDefer() { |
417 did_defer_ = true; | 421 did_defer_ = true; |
418 request()->LogBlockedBy("CrossSiteResourceHandler"); | 422 request()->LogBlockedBy("CrossSiteResourceHandler"); |
419 } | 423 } |
420 | 424 |
421 } // namespace content | 425 } // namespace content |
OLD | NEW |