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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_loader.h

Issue 2821133003: Write loading signal extra data in JSON (Closed)
Patch Set: fix comment Created 3 years, 8 months 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 | « no previous file | chrome/browser/android/offline_pages/prerendering_loader.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 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 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/values.h"
13 #include "chrome/browser/android/offline_pages/prerender_adapter.h" 14 #include "chrome/browser/android/offline_pages/prerender_adapter.h"
14 #include "components/offline_pages/core/background/offliner.h" 15 #include "components/offline_pages/core/background/offliner.h"
15 #include "components/offline_pages/core/snapshot_controller.h" 16 #include "components/offline_pages/core/snapshot_controller.h"
16 17
17 class GURL; 18 class GURL;
18 19
19 namespace content { 20 namespace content {
20 class BrowserContext; 21 class BrowserContext;
21 class WebContents; 22 class WebContents;
22 } // namespace content 23 } // namespace content
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void OnPrerenderDomContentLoaded() override; 78 void OnPrerenderDomContentLoaded() override;
78 void OnPrerenderStop() override; 79 void OnPrerenderStop() override;
79 void OnPrerenderNetworkBytesChanged(int64_t bytes) override; 80 void OnPrerenderNetworkBytesChanged(int64_t bytes) override;
80 81
81 // SnapshotController::Client implementation: 82 // SnapshotController::Client implementation:
82 void StartSnapshot() override; 83 void StartSnapshot() override;
83 84
84 // Returns true if the lowbar of snapshotting a page is met. 85 // Returns true if the lowbar of snapshotting a page is met.
85 virtual bool IsLowbarMet(); 86 virtual bool IsLowbarMet();
86 87
87 // Returns a vector of strings for analysis of loading progress. 88 // Returns a JSON dictionary value for analysis of loading progress.
88 const std::vector<std::string>& GetLoadingSignalData() { 89 const base::DictionaryValue& GetLoadingSignalData() { return signal_data_; }
89 return signal_data_;
90 }
91 90
92 private: 91 private:
93 // State of the loader (only one request may be active at a time). 92 // State of the loader (only one request may be active at a time).
94 enum class State { 93 enum class State {
95 IDLE, // No active load request. 94 IDLE, // No active load request.
96 PENDING, // Load request is pending the start of prerendering. 95 PENDING, // Load request is pending the start of prerendering.
97 LOADING, // Loading in progress. 96 LOADING, // Loading in progress.
98 LOADED, // Loaded and now waiting for requestor to StopLoading(). 97 LOADED, // Loaded and now waiting for requestor to StopLoading().
99 }; 98 };
100 99
(...skipping 26 matching lines...) Expand all
127 content::BrowserContext* browser_context_; 126 content::BrowserContext* browser_context_;
128 127
129 // Adapter for handling calls to the prerender stack. 128 // Adapter for handling calls to the prerender stack.
130 std::unique_ptr<PrerenderAdapter> adapter_; 129 std::unique_ptr<PrerenderAdapter> adapter_;
131 130
132 // A WebContents for the active load request that is used to hold the session 131 // A WebContents for the active load request that is used to hold the session
133 // storage namespace for rendering. This will NOT have the loaded page. 132 // storage namespace for rendering. This will NOT have the loaded page.
134 std::unique_ptr<content::WebContents> session_contents_; 133 std::unique_ptr<content::WebContents> session_contents_;
135 134
136 // Signal data collected for this rendering attempt 135 // Signal data collected for this rendering attempt
137 std::vector<std::string> signal_data_; 136 base::DictionaryValue signal_data_;
138 137
139 // Callback to call when the active load request completes, fails, or is 138 // Callback to call when the active load request completes, fails, or is
140 // canceled. 139 // canceled.
141 LoadPageCallback load_done_callback_; 140 LoadPageCallback load_done_callback_;
142 141
143 // Callback to call when we know more bytes have loaded from the network. 142 // Callback to call when we know more bytes have loaded from the network.
144 ProgressCallback progress_callback_; 143 ProgressCallback progress_callback_;
145 144
146 // True if the lowbar of snapshotting a page is met. 145 // True if the lowbar of snapshotting a page is met.
147 bool is_lowbar_met_; 146 bool is_lowbar_met_;
148 147
149 // Time in ticks of when we start loading the page. 148 // Time in ticks of when we start loading the page.
150 base::TimeTicks load_start_time_; 149 base::TimeTicks load_start_time_;
151 150
152 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader); 151 DISALLOW_COPY_AND_ASSIGN(PrerenderingLoader);
153 }; 152 };
154 153
155 } // namespace offline_pages 154 } // namespace offline_pages
156 155
157 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_ 156 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698