| 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 "chrome/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 alias_session_storage_namespace->AddTransactionLogProcessId(child_id_); | 343 alias_session_storage_namespace->AddTransactionLogProcessId(child_id_); |
| 344 | 344 |
| 345 // Add the RenderProcessHost to the Prerender Manager. | 345 // Add the RenderProcessHost to the Prerender Manager. |
| 346 prerender_manager()->AddPrerenderProcessHost( | 346 prerender_manager()->AddPrerenderProcessHost( |
| 347 GetRenderViewHost()->GetProcess()); | 347 GetRenderViewHost()->GetProcess()); |
| 348 | 348 |
| 349 // In the prerender tracker, create a Prerender Cookie Store to keep track of | 349 // In the prerender tracker, create a Prerender Cookie Store to keep track of |
| 350 // cookie changes performed by the prerender. Once the prerender is shown, | 350 // cookie changes performed by the prerender. Once the prerender is shown, |
| 351 // the cookie changes will be committed to the actual cookie store, | 351 // the cookie changes will be committed to the actual cookie store, |
| 352 // otherwise, they will be discarded. | 352 // otherwise, they will be discarded. |
| 353 BrowserThread::PostTask( | 353 // If |request_context| is NULL, the feature must be disabled, so the |
| 354 BrowserThread::IO, FROM_HERE, | 354 // operation will not be performed. |
| 355 base::Bind(&PrerenderTracker::AddPrerenderCookieStoreOnIOThread, | 355 if (request_context) { |
| 356 base::Unretained(prerender_manager()->prerender_tracker()), | 356 BrowserThread::PostTask( |
| 357 GetRenderViewHost()->GetProcess()->GetID(), | 357 BrowserThread::IO, FROM_HERE, |
| 358 make_scoped_refptr(request_context), | 358 base::Bind(&PrerenderTracker::AddPrerenderCookieStoreOnIOThread, |
| 359 base::Bind(&PrerenderContents::Destroy, | 359 base::Unretained(prerender_manager()->prerender_tracker()), |
| 360 AsWeakPtr(), | 360 GetRenderViewHost()->GetProcess()->GetID(), |
| 361 FINAL_STATUS_COOKIE_CONFLICT))); | 361 make_scoped_refptr(request_context), |
| 362 base::Bind(&PrerenderContents::Destroy, |
| 363 AsWeakPtr(), |
| 364 FINAL_STATUS_COOKIE_CONFLICT))); |
| 365 } |
| 362 | 366 |
| 363 NotifyPrerenderStart(); | 367 NotifyPrerenderStart(); |
| 364 | 368 |
| 365 // Close ourselves when the application is shutting down. | 369 // Close ourselves when the application is shutting down. |
| 366 notification_registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 370 notification_registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
| 367 content::NotificationService::AllSources()); | 371 content::NotificationService::AllSources()); |
| 368 | 372 |
| 369 // Register to inform new RenderViews that we're prerendering. | 373 // Register to inform new RenderViews that we're prerendering. |
| 370 notification_registrar_.Add( | 374 notification_registrar_.Add( |
| 371 this, content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 375 this, content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 void PrerenderContents::AddResourceThrottle( | 903 void PrerenderContents::AddResourceThrottle( |
| 900 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { | 904 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { |
| 901 resource_throttles_.push_back(throttle); | 905 resource_throttles_.push_back(throttle); |
| 902 } | 906 } |
| 903 | 907 |
| 904 void PrerenderContents::AddNetworkBytes(int64 bytes) { | 908 void PrerenderContents::AddNetworkBytes(int64 bytes) { |
| 905 network_bytes_ += bytes; | 909 network_bytes_ += bytes; |
| 906 } | 910 } |
| 907 | 911 |
| 908 } // namespace prerender | 912 } // namespace prerender |
| OLD | NEW |