Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: content/public/renderer/document_state.h

Issue 2449553002: Remove dead DocumentState metrics tracking code (Closed)
Patch Set: fix tests Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/navigation_params.cc ('k') | content/public/renderer/document_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ 5 #ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ 6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "net/http/http_response_info.h" 15 #include "net/http/http_response_info.h"
16 #include "third_party/WebKit/public/web/WebDataSource.h" 16 #include "third_party/WebKit/public/web/WebDataSource.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 class NavigationState; 21 class NavigationState;
22 22
23 // The RenderView stores an instance of this class in the "extra data" of each 23 // The RenderView stores an instance of this class in the "extra data" of each
24 // WebDataSource (see RenderView::DidCreateDataSource). 24 // WebDataSource (see RenderView::DidCreateDataSource).
25 class CONTENT_EXPORT DocumentState 25 class CONTENT_EXPORT DocumentState
26 : NON_EXPORTED_BASE(public blink::WebDataSource::ExtraData), 26 : NON_EXPORTED_BASE(public blink::WebDataSource::ExtraData),
27 public base::SupportsUserData { 27 public base::SupportsUserData {
28 public: 28 public:
29 // The exact values of this enum are used in histograms, so new values must be
30 // added to the end.
31 enum LoadType {
32 UNDEFINED_LOAD, // Not yet initialized.
33 RELOAD, // User pressed reload.
34 HISTORY_LOAD, // Back or forward.
35 NORMAL_LOAD, // User entered URL, or omnibox search.
36 LINK_LOAD, // (deprecated) Included next 4 categories.
37 LINK_LOAD_NORMAL, // Commonly following of link.
38 LINK_LOAD_RELOAD, // JS/link directed reload.
39 LINK_LOAD_CACHE_STALE_OK, // back/forward or encoding change.
40 LINK_LOAD_CACHE_ONLY, // Allow stale data (avoid doing a re-post)
41 kLoadTypeMax // Bounding value for this enum.
42 };
43
44 DocumentState(); 29 DocumentState();
45 ~DocumentState() override; 30 ~DocumentState() override;
46 31
47 static DocumentState* FromDataSource(blink::WebDataSource* ds) { 32 static DocumentState* FromDataSource(blink::WebDataSource* ds) {
48 return static_cast<DocumentState*>(ds->getExtraData()); 33 return static_cast<DocumentState*>(ds->getExtraData());
49 } 34 }
50 35
51 // The time that this navigation was requested.
52 const base::Time& request_time() const {
53 return request_time_;
54 }
55 void set_request_time(const base::Time& value) {
56 DCHECK(start_load_time_.is_null());
57 request_time_ = value;
58 }
59
60 // The time that the document load started.
61 const base::Time& start_load_time() const {
62 return start_load_time_;
63 }
64 void set_start_load_time(const base::Time& value) {
65 // TODO(jar): This should not be set twice.
66 // DCHECK(!start_load_time_.is_null());
67 DCHECK(finish_document_load_time_.is_null());
68 start_load_time_ = value;
69 }
70
71 // The time that the document load was committed.
72 const base::Time& commit_load_time() const {
73 return commit_load_time_;
74 }
75 void set_commit_load_time(const base::Time& value) {
76 commit_load_time_ = value;
77 }
78
79 // The time that the document finished loading.
80 const base::Time& finish_document_load_time() const {
81 return finish_document_load_time_;
82 }
83 void set_finish_document_load_time(const base::Time& value) {
84 // TODO(jar): Some unittests break the following DCHECK, and don't have
85 // DCHECK(!start_load_time_.is_null());
86 DCHECK(!value.is_null());
87 // TODO(jar): Double setting does happen, but probably shouldn't.
88 // DCHECK(finish_document_load_time_.is_null());
89 // TODO(jar): We should guarantee this order :-(.
90 // DCHECK(finish_load_time_.is_null());
91 finish_document_load_time_ = value;
92 }
93
94 // The time that the document and all subresources finished loading.
95 const base::Time& finish_load_time() const { return finish_load_time_; }
96 void set_finish_load_time(const base::Time& value) {
97 DCHECK(!value.is_null());
98 DCHECK(finish_load_time_.is_null());
99 // The following is not already set in all cases :-(
100 // DCHECK(!finish_document_load_time_.is_null());
101 finish_load_time_ = value;
102 }
103
104 // True iff the histograms for the associated frame have been dumped.
105 bool load_histograms_recorded() const { return load_histograms_recorded_; }
106 void set_load_histograms_recorded(bool value) {
107 load_histograms_recorded_ = value;
108 }
109
110 bool web_timing_histograms_recorded() const {
111 return web_timing_histograms_recorded_;
112 }
113 void set_web_timing_histograms_recorded(bool value) {
114 web_timing_histograms_recorded_ = value;
115 }
116
117 // Indicator if SPDY was used as part of this page load. 36 // Indicator if SPDY was used as part of this page load.
118 bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; } 37 bool was_fetched_via_spdy() const { return was_fetched_via_spdy_; }
119 void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; } 38 void set_was_fetched_via_spdy(bool value) { was_fetched_via_spdy_ = value; }
120 39
121 bool was_alpn_negotiated() const { return was_alpn_negotiated_; } 40 bool was_alpn_negotiated() const { return was_alpn_negotiated_; }
122 void set_was_alpn_negotiated(bool value) { was_alpn_negotiated_ = value; } 41 void set_was_alpn_negotiated(bool value) { was_alpn_negotiated_ = value; }
123 42
124 const std::string& alpn_negotiated_protocol() const { 43 const std::string& alpn_negotiated_protocol() const {
125 return alpn_negotiated_protocol_; 44 return alpn_negotiated_protocol_;
126 } 45 }
(...skipping 26 matching lines...) Expand all
153 bool was_load_data_with_base_url_request() const { 72 bool was_load_data_with_base_url_request() const {
154 return was_load_data_with_base_url_request_; 73 return was_load_data_with_base_url_request_;
155 } 74 }
156 const GURL& data_url() const { 75 const GURL& data_url() const {
157 return data_url_; 76 return data_url_;
158 } 77 }
159 void set_data_url(const GURL& data_url) { 78 void set_data_url(const GURL& data_url) {
160 data_url_ = data_url; 79 data_url_ = data_url;
161 } 80 }
162 81
163 // Record the nature of this load, for use when histogramming page load times.
164 LoadType load_type() const { return load_type_; }
165 void set_load_type(LoadType load_type) { load_type_ = load_type; }
166
167 NavigationState* navigation_state() { return navigation_state_.get(); } 82 NavigationState* navigation_state() { return navigation_state_.get(); }
168 void set_navigation_state(NavigationState* navigation_state); 83 void set_navigation_state(NavigationState* navigation_state);
169 84
170 bool can_load_local_resources() const { return can_load_local_resources_; } 85 bool can_load_local_resources() const { return can_load_local_resources_; }
171 void set_can_load_local_resources(bool can_load) { 86 void set_can_load_local_resources(bool can_load) {
172 can_load_local_resources_ = can_load; 87 can_load_local_resources_ = can_load;
173 } 88 }
174 89
175 private: 90 private:
176 base::Time request_time_;
177 base::Time start_load_time_;
178 base::Time commit_load_time_;
179 base::Time finish_document_load_time_;
180 base::Time finish_load_time_;
181 bool load_histograms_recorded_;
182 bool web_timing_histograms_recorded_;
183 bool was_fetched_via_spdy_; 91 bool was_fetched_via_spdy_;
184 bool was_alpn_negotiated_; 92 bool was_alpn_negotiated_;
185 std::string alpn_negotiated_protocol_; 93 std::string alpn_negotiated_protocol_;
186 bool was_alternate_protocol_available_; 94 bool was_alternate_protocol_available_;
187 net::HttpResponseInfo::ConnectionInfo connection_info_; 95 net::HttpResponseInfo::ConnectionInfo connection_info_;
188 96
189 bool was_load_data_with_base_url_request_; 97 bool was_load_data_with_base_url_request_;
190 GURL data_url_; 98 GURL data_url_;
191 99
192 LoadType load_type_;
193
194 std::unique_ptr<NavigationState> navigation_state_; 100 std::unique_ptr<NavigationState> navigation_state_;
195 101
196 bool can_load_local_resources_; 102 bool can_load_local_resources_;
197 }; 103 };
198 104
199 } // namespace content 105 } // namespace content
200 106
201 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ 107 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_
OLDNEW
« no previous file with comments | « content/common/navigation_params.cc ('k') | content/public/renderer/document_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698