| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/offline_pages/prerendering_loader.h" | 5 #include "chrome/browser/android/offline_pages/prerendering_loader.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // when to consider it really LOADED. | 123 // when to consider it really LOADED. |
| 124 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); | 124 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void PrerenderingLoader::OnPrerenderDomContentLoaded() { | 127 void PrerenderingLoader::OnPrerenderDomContentLoaded() { |
| 128 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 128 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 129 DCHECK(!IsIdle()); | 129 DCHECK(!IsIdle()); |
| 130 if (!adapter_->GetWebContents()) { | 130 if (!adapter_->GetWebContents()) { |
| 131 // Without a WebContents object at this point, we are done. | 131 // Without a WebContents object at this point, we are done. |
| 132 HandleLoadingStopped(); | 132 HandleLoadingStopped(); |
| 133 } else { | |
| 134 // Inform SnapshotController of DomContentContent event so it can | |
| 135 // determine when to consider it really LOADED (e.g., some multiple | |
| 136 // second delay from this event). | |
| 137 snapshot_controller_->DocumentAvailableInMainFrame(); | |
| 138 } | 133 } |
| 139 } | 134 } |
| 140 | 135 |
| 141 void PrerenderingLoader::OnPrerenderStop() { | 136 void PrerenderingLoader::OnPrerenderStop() { |
| 142 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 137 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 143 HandleLoadingStopped(); | 138 HandleLoadingStopped(); |
| 144 } | 139 } |
| 145 | 140 |
| 146 void PrerenderingLoader::StartSnapshot() { | 141 void PrerenderingLoader::StartSnapshot() { |
| 147 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 142 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 void PrerenderingLoader::CancelPrerender() { | 215 void PrerenderingLoader::CancelPrerender() { |
| 221 if (adapter_->IsActive()) { | 216 if (adapter_->IsActive()) { |
| 222 adapter_->DestroyActive(); | 217 adapter_->DestroyActive(); |
| 223 } | 218 } |
| 224 snapshot_controller_.reset(nullptr); | 219 snapshot_controller_.reset(nullptr); |
| 225 session_contents_.reset(nullptr); | 220 session_contents_.reset(nullptr); |
| 226 state_ = State::IDLE; | 221 state_ = State::IDLE; |
| 227 } | 222 } |
| 228 | 223 |
| 229 } // namespace offline_pages | 224 } // namespace offline_pages |
| OLD | NEW |