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: components/html_viewer/html_document.cc

Issue 1391963004: Correctly record and pass around navigation start time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/html_viewer/html_document.h" 5 #include "components/html_viewer/html_document.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h"
13 #include "components/html_viewer/blink_url_request_type_converters.h" 14 #include "components/html_viewer/blink_url_request_type_converters.h"
14 #include "components/html_viewer/devtools_agent_impl.h" 15 #include "components/html_viewer/devtools_agent_impl.h"
15 #include "components/html_viewer/document_resource_waiter.h" 16 #include "components/html_viewer/document_resource_waiter.h"
16 #include "components/html_viewer/global_state.h" 17 #include "components/html_viewer/global_state.h"
17 #include "components/html_viewer/html_frame.h" 18 #include "components/html_viewer/html_frame.h"
18 #include "components/html_viewer/html_frame_tree_manager.h" 19 #include "components/html_viewer/html_frame_tree_manager.h"
19 #include "components/html_viewer/test_html_viewer_impl.h" 20 #include "components/html_viewer/test_html_viewer_impl.h"
20 #include "components/html_viewer/web_url_loader_impl.h" 21 #include "components/html_viewer/web_url_loader_impl.h"
21 #include "components/mus/public/cpp/view.h" 22 #include "components/mus/public/cpp/view.h"
22 #include "components/mus/public/cpp/view_tree_connection.h" 23 #include "components/mus/public/cpp/view_tree_connection.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (view) { 154 if (view) {
154 global_state_->InitIfNecessary( 155 global_state_->InitIfNecessary(
155 view->viewport_metrics().size_in_pixels.To<gfx::Size>(), 156 view->viewport_metrics().size_in_pixels.To<gfx::Size>(),
156 view->viewport_metrics().device_pixel_ratio); 157 view->viewport_metrics().device_pixel_ratio);
157 } 158 }
158 159
159 scoped_ptr<WebURLRequestExtraData> extra_data(new WebURLRequestExtraData); 160 scoped_ptr<WebURLRequestExtraData> extra_data(new WebURLRequestExtraData);
160 extra_data->synthetic_response = 161 extra_data->synthetic_response =
161 resource_waiter_->ReleaseURLResponse().Pass(); 162 resource_waiter_->ReleaseURLResponse().Pass();
162 163
164 base::TimeTicks navigation_start_time =
165 resource_waiter_->navigation_start_time();
163 frame_ = HTMLFrameTreeManager::CreateFrameAndAttachToTree( 166 frame_ = HTMLFrameTreeManager::CreateFrameAndAttachToTree(
164 global_state_, view, resource_waiter_.Pass(), this); 167 global_state_, view, resource_waiter_.Pass(), this);
165 168
166 // If the frame wasn't created we can destroy ourself. 169 // If the frame wasn't created we can destroy ourself.
167 if (!frame_) { 170 if (!frame_) {
168 Destroy(); 171 Destroy();
169 return; 172 return;
170 } 173 }
171 174
172 if (devtools_agent_request_.is_pending()) { 175 if (devtools_agent_request_.is_pending()) {
173 if (frame_->devtools_agent()) { 176 if (frame_->devtools_agent()) {
174 frame_->devtools_agent()->BindToRequest(devtools_agent_request_.Pass()); 177 frame_->devtools_agent()->BindToRequest(devtools_agent_request_.Pass());
175 } else { 178 } else {
176 devtools_agent_request_ = 179 devtools_agent_request_ =
177 mojo::InterfaceRequest<devtools_service::DevToolsAgent>(); 180 mojo::InterfaceRequest<devtools_service::DevToolsAgent>();
178 } 181 }
179 } 182 }
180 183
181 const GURL url(extra_data->synthetic_response->url); 184 const GURL url(extra_data->synthetic_response->url);
182 185
183 blink::WebURLRequest web_request; 186 blink::WebURLRequest web_request;
184 web_request.initialize(); 187 web_request.initialize();
185 web_request.setURL(url); 188 web_request.setURL(url);
186 web_request.setExtraData(extra_data.release()); 189 web_request.setExtraData(extra_data.release());
187 190
188 frame_->LoadRequest(web_request); 191 frame_->LoadRequest(web_request, navigation_start_time);
189 } 192 }
190 193
191 HTMLDocument::BeforeLoadCache* HTMLDocument::GetBeforeLoadCache() { 194 HTMLDocument::BeforeLoadCache* HTMLDocument::GetBeforeLoadCache() {
192 CHECK(!did_finish_local_frame_load_); 195 CHECK(!did_finish_local_frame_load_);
193 if (!before_load_cache_.get()) 196 if (!before_load_cache_.get())
194 before_load_cache_.reset(new BeforeLoadCache); 197 before_load_cache_.reset(new BeforeLoadCache);
195 return before_load_cache_.get(); 198 return before_load_cache_.get();
196 } 199 }
197 200
198 void HTMLDocument::OnEmbed(View* root) { 201 void HTMLDocument::OnEmbed(View* root) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 mojo::InterfaceRequest<mojo::ViewTreeClient> request) { 317 mojo::InterfaceRequest<mojo::ViewTreeClient> request) {
315 DCHECK(!transferable_state_.view_tree_delegate_impl); 318 DCHECK(!transferable_state_.view_tree_delegate_impl);
316 transferable_state_.view_tree_delegate_impl.reset( 319 transferable_state_.view_tree_delegate_impl.reset(
317 new ViewTreeDelegateImpl(this)); 320 new ViewTreeDelegateImpl(this));
318 transferable_state_.owns_view_tree_connection = true; 321 transferable_state_.owns_view_tree_connection = true;
319 mus::ViewTreeConnection::Create( 322 mus::ViewTreeConnection::Create(
320 transferable_state_.view_tree_delegate_impl.get(), request.Pass()); 323 transferable_state_.view_tree_delegate_impl.get(), request.Pass());
321 } 324 }
322 325
323 } // namespace html_viewer 326 } // namespace html_viewer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698