Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/page_load_metrics/metrics_web_contents_observer.h" | 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 navigation_handle, | 171 navigation_handle, |
| 172 base::MakeUnique<PageLoadTracker>( | 172 base::MakeUnique<PageLoadTracker>( |
| 173 in_foreground_, embedder_interface_.get(), currently_committed_url, | 173 in_foreground_, embedder_interface_.get(), currently_committed_url, |
| 174 navigation_handle, user_initiated_info, chain_size, | 174 navigation_handle, user_initiated_info, chain_size, |
| 175 chain_size_same_url))); | 175 chain_size_same_url))); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void MetricsWebContentsObserver::OnRequestComplete( | 178 void MetricsWebContentsObserver::OnRequestComplete( |
| 179 content::ResourceType resource_type, | 179 content::ResourceType resource_type, |
| 180 bool was_cached, | 180 bool was_cached, |
| 181 int net_error) { | 181 int net_error, |
| 182 int64_t raw_body_bytes) { | |
| 182 // For simplicity, only count subresources. Navigations are hard to attribute | 183 // For simplicity, only count subresources. Navigations are hard to attribute |
| 183 // here because we won't have a committed load by the time data streams in | 184 // here because we won't have a committed load by the time data streams in |
| 184 // from the IO thread. | 185 // from the IO thread. |
| 185 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && | 186 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME && |
|
RyanSturm
2016/12/12 22:29:38
Does this conditional match the comment?
It looks
RyanSturm
2016/12/12 23:17:14
As of https://crrev.com/4434137b674aa5703a2f1e3cf
jkarlin
2016/12/14 18:26:29
You're right, that should be an or. So right now w
RyanSturm
2016/12/14 19:56:07
AFAIK, ChromeResourceDispatcherHostDelegate::Reque
| |
| 186 net_error != net::OK) { | 187 net_error != net::OK) { |
| 187 return; | 188 return; |
| 188 } | 189 } |
| 189 if (!committed_load_) | 190 if (!committed_load_) |
| 190 return; | 191 return; |
| 191 committed_load_->OnLoadedSubresource(was_cached); | 192 committed_load_->OnLoadedSubresource(was_cached, raw_body_bytes); |
| 192 } | 193 } |
| 193 | 194 |
| 194 const PageLoadExtraInfo | 195 const PageLoadExtraInfo |
| 195 MetricsWebContentsObserver::GetPageLoadExtraInfoForCommittedLoad() { | 196 MetricsWebContentsObserver::GetPageLoadExtraInfoForCommittedLoad() { |
| 196 DCHECK(committed_load_); | 197 DCHECK(committed_load_); |
| 197 return committed_load_->ComputePageLoadExtraInfo(); | 198 return committed_load_->ComputePageLoadExtraInfo(); |
| 198 } | 199 } |
| 199 | 200 |
| 200 void MetricsWebContentsObserver::DidFinishNavigation( | 201 void MetricsWebContentsObserver::DidFinishNavigation( |
| 201 content::NavigationHandle* navigation_handle) { | 202 content::NavigationHandle* navigation_handle) { |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 content::NavigationHandle* navigation_handle) const { | 474 content::NavigationHandle* navigation_handle) const { |
| 474 DCHECK(navigation_handle->IsInMainFrame()); | 475 DCHECK(navigation_handle->IsInMainFrame()); |
| 475 DCHECK(!navigation_handle->HasCommitted() || | 476 DCHECK(!navigation_handle->HasCommitted() || |
| 476 !navigation_handle->IsSamePage()); | 477 !navigation_handle->IsSamePage()); |
| 477 | 478 |
| 478 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), | 479 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), |
| 479 navigation_handle).ShouldTrack(); | 480 navigation_handle).ShouldTrack(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 } // namespace page_load_metrics | 483 } // namespace page_load_metrics |
| OLD | NEW |