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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 adapter_ = std::move(prerender_adapter); | 145 adapter_ = std::move(prerender_adapter); |
146 } | 146 } |
147 | 147 |
148 void PrerenderingLoader::OnPrerenderStopLoading() { | 148 void PrerenderingLoader::OnPrerenderStopLoading() { |
149 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 149 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
150 DCHECK(!IsIdle()); | 150 DCHECK(!IsIdle()); |
151 DCHECK(adapter_->GetWebContents()); | 151 DCHECK(adapter_->GetWebContents()); |
152 // Inform SnapshotController of OnLoad event so it can determine | 152 // Inform SnapshotController of OnLoad event so it can determine |
153 // when to consider it really LOADED. | 153 // when to consider it really LOADED. |
154 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); | 154 snapshot_controller_->DocumentOnLoadCompletedInMainFrame(); |
155 | |
156 // Add this signal to signal_data_. | |
157 signal_data_.push_back(std::string("OnLoad signal seen")); | |
fgorski
2017/03/08 18:56:42
OnLoad,time_ms
Please :)
| |
155 } | 158 } |
156 | 159 |
157 void PrerenderingLoader::OnPrerenderDomContentLoaded() { | 160 void PrerenderingLoader::OnPrerenderDomContentLoaded() { |
158 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 161 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
159 DCHECK(!IsIdle()); | 162 DCHECK(!IsIdle()); |
160 if (!adapter_->GetWebContents()) { | 163 if (!adapter_->GetWebContents()) { |
161 // Without a WebContents object at this point, we are done. | 164 // Without a WebContents object at this point, we are done. |
162 HandleLoadingStopped(); | 165 HandleLoadingStopped(); |
163 } else { | 166 } else { |
164 is_lowbar_met_ = true; | 167 is_lowbar_met_ = true; |
165 if (kConsiderDclForSnapshot) { | 168 if (kConsiderDclForSnapshot) { |
166 // Inform SnapshotController of DomContentLoaded event so it can | 169 // Inform SnapshotController of DomContentLoaded event so it can |
167 // determine when to consider it really LOADED (e.g., some multiple | 170 // determine when to consider it really LOADED (e.g., some multiple |
168 // second delay from this event). | 171 // second delay from this event). |
169 snapshot_controller_->DocumentAvailableInMainFrame(); | 172 snapshot_controller_->DocumentAvailableInMainFrame(); |
170 } | 173 } |
174 | |
175 // Add this signal to signal_data_. | |
176 signal_data_.push_back(std::string("Dom Content Loaded signal seen")); | |
fgorski
2017/03/08 18:56:42
DomContentLoaded,time_ms
Please :)
| |
171 } | 177 } |
172 } | 178 } |
173 | 179 |
174 void PrerenderingLoader::OnPrerenderStop() { | 180 void PrerenderingLoader::OnPrerenderStop() { |
175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 181 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
176 HandleLoadingStopped(); | 182 HandleLoadingStopped(); |
177 } | 183 } |
178 | 184 |
179 void PrerenderingLoader::OnPrerenderNetworkBytesChanged(int64_t bytes) { | 185 void PrerenderingLoader::OnPrerenderNetworkBytesChanged(int64_t bytes) { |
180 if (state_ == State::LOADING) | 186 if (state_ == State::LOADING) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 if (adapter_->IsActive()) { | 274 if (adapter_->IsActive()) { |
269 adapter_->DestroyActive(); | 275 adapter_->DestroyActive(); |
270 } | 276 } |
271 snapshot_controller_.reset(nullptr); | 277 snapshot_controller_.reset(nullptr); |
272 session_contents_.reset(nullptr); | 278 session_contents_.reset(nullptr); |
273 state_ = State::IDLE; | 279 state_ = State::IDLE; |
274 is_lowbar_met_ = false; | 280 is_lowbar_met_ = false; |
275 } | 281 } |
276 | 282 |
277 } // namespace offline_pages | 283 } // namespace offline_pages |
OLD | NEW |