Chromium Code Reviews| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 adapter_ = std::move(prerender_adapter); | 142 adapter_ = std::move(prerender_adapter); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void PrerenderingLoader::OnPrerenderStopLoading() { | 145 void PrerenderingLoader::OnPrerenderStopLoading() { |
| 146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 146 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 147 DCHECK(!IsIdle()); | 147 DCHECK(!IsIdle()); |
| 148 DCHECK(adapter_->GetWebContents()); | 148 DCHECK(adapter_->GetWebContents()); |
| 149 // Inform SnapshotController of OnLoad event so it can determine | 149 // Inform SnapshotController of OnLoad event so it can determine |
| 150 // when to consider it really LOADED. | 150 // when to consider it really LOADED. |
| 151 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); | 151 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); |
| 152 | |
| 153 // Add this signal to signal_data_. | |
| 154 signal_data_.push_back(std::string("OnLoad seen")); | |
|
fgorski
2017/02/07 22:06:08
"OnLoad" is enough, as "seen" is implied.
How abo
| |
| 152 } | 155 } |
| 153 | 156 |
| 154 void PrerenderingLoader::OnPrerenderDomContentLoaded() { | 157 void PrerenderingLoader::OnPrerenderDomContentLoaded() { |
| 155 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 158 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 156 DCHECK(!IsIdle()); | 159 DCHECK(!IsIdle()); |
| 157 if (!adapter_->GetWebContents()) { | 160 if (!adapter_->GetWebContents()) { |
| 158 // Without a WebContents object at this point, we are done. | 161 // Without a WebContents object at this point, we are done. |
| 159 HandleLoadingStopped(); | 162 HandleLoadingStopped(); |
| 160 } else if (kConsiderDclForSnapshot) { | 163 } else if (kConsiderDclForSnapshot) { |
| 161 // Inform SnapshotController of DomContentLoaded event so it can | 164 // Inform SnapshotController of DomContentLoaded event so it can |
| 162 // determine when to consider it really LOADED (e.g., some multiple | 165 // determine when to consider it really LOADED (e.g., some multiple |
| 163 // second delay from this event). | 166 // second delay from this event). |
| 164 snapshot_controller_->DocumentAvailableInMainFrame(); | 167 snapshot_controller_->DocumentAvailableInMainFrame(); |
| 168 | |
| 169 // Add this signal to signal_data_. | |
| 170 signal_data_.push_back(std::string("DCL seen")); | |
|
fgorski
2017/02/07 22:06:08
can you please expand DCL to full name and remove
| |
| 165 } | 171 } |
| 166 } | 172 } |
| 167 | 173 |
| 168 void PrerenderingLoader::OnPrerenderStop() { | 174 void PrerenderingLoader::OnPrerenderStop() { |
| 169 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 170 HandleLoadingStopped(); | 176 HandleLoadingStopped(); |
| 171 } | 177 } |
| 172 | 178 |
| 173 void PrerenderingLoader::StartSnapshot() { | 179 void PrerenderingLoader::StartSnapshot() { |
| 174 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 void PrerenderingLoader::CancelPrerender() { | 257 void PrerenderingLoader::CancelPrerender() { |
| 252 if (adapter_->IsActive()) { | 258 if (adapter_->IsActive()) { |
| 253 adapter_->DestroyActive(); | 259 adapter_->DestroyActive(); |
| 254 } | 260 } |
| 255 snapshot_controller_.reset(nullptr); | 261 snapshot_controller_.reset(nullptr); |
| 256 session_contents_.reset(nullptr); | 262 session_contents_.reset(nullptr); |
| 257 state_ = State::IDLE; | 263 state_ = State::IDLE; |
| 258 } | 264 } |
| 259 | 265 |
| 260 } // namespace offline_pages | 266 } // namespace offline_pages |
| OLD | NEW |