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

Side by Side Diff: components/web_view/url_request_cloneable.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
« no previous file with comments | « components/web_view/url_request_cloneable.h ('k') | components/web_view/web_view_impl.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 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 "components/web_view/url_request_cloneable.h" 5 #include "components/web_view/url_request_cloneable.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/common/data_pipe_utils.h" 8 #include "mojo/common/data_pipe_utils.h"
9 #include "mojo/common/url_type_converters.h" 9 #include "mojo/common/url_type_converters.h"
10 10
11 namespace web_view { 11 namespace web_view {
12 12
13 // TODO(erg): In the long run, we might not want to have a stack of 13 // TODO(erg): In the long run, we might not want to have a stack of
14 // URLRequestPtrs, but another type that captures most of the data. When I saw 14 // URLRequestPtrs, but another type that captures most of the data. When I saw
15 // NavigationController the first time, I didn't understand why they made their 15 // NavigationController the first time, I didn't understand why they made their
16 // own datastructure which kept track of everything in a request. The reason is 16 // own datastructure which kept track of everything in a request. The reason is
17 // that they have to build requests from multiple different datatypes. 17 // that they have to build requests from multiple different datatypes.
18 18
19 URLRequestCloneable::URLRequestCloneable(mojo::URLRequestPtr original_request) 19 URLRequestCloneable::URLRequestCloneable(mojo::URLRequestPtr original_request)
20 : url_(original_request->url), 20 : url_(original_request->url),
21 method_(original_request->method), 21 method_(original_request->method),
22 headers_(original_request->headers.Pass()), 22 headers_(original_request->headers.Pass()),
23 response_body_buffer_size_(original_request->response_body_buffer_size), 23 response_body_buffer_size_(original_request->response_body_buffer_size),
24 auto_follow_redirects_(original_request->auto_follow_redirects), 24 auto_follow_redirects_(original_request->auto_follow_redirects),
25 bypass_cache_(original_request->bypass_cache), 25 bypass_cache_(original_request->bypass_cache),
26 original_body_null_(original_request->body.is_null()), 26 original_body_null_(original_request->body.is_null()),
27 body_(original_request->body.size()) { 27 body_(original_request->body.size()),
28 originating_time_(base::TimeTicks::FromInternalValue(
29 original_request->originating_time_ticks)) {
28 // TODO(erg): Maybe we can do some sort of async copy here? 30 // TODO(erg): Maybe we can do some sort of async copy here?
29 for (size_t i = 0; i < original_request->body.size(); ++i) { 31 for (size_t i = 0; i < original_request->body.size(); ++i) {
30 mojo::common::BlockingCopyToString(original_request->body[i].Pass(), 32 mojo::common::BlockingCopyToString(original_request->body[i].Pass(),
31 &body_[i]); 33 &body_[i]);
32 } 34 }
33 } 35 }
34 36
35 URLRequestCloneable::URLRequestCloneable(const GURL& raw_url) 37 URLRequestCloneable::URLRequestCloneable(const GURL& raw_url)
36 : url_(mojo::String::From(raw_url)), 38 : url_(mojo::String::From(raw_url)),
37 method_("GET"), 39 method_("GET"),
(...skipping 26 matching lines...) Expand all
64 options.element_num_bytes = 1; 66 options.element_num_bytes = 1;
65 options.capacity_num_bytes = num_bytes; 67 options.capacity_num_bytes = num_bytes;
66 mojo::DataPipe data_pipe(options); 68 mojo::DataPipe data_pipe(options);
67 request->body[i] = data_pipe.consumer_handle.Pass(); 69 request->body[i] = data_pipe.consumer_handle.Pass();
68 WriteDataRaw(data_pipe.producer_handle.get(), body_[i].data(), &num_bytes, 70 WriteDataRaw(data_pipe.producer_handle.get(), body_[i].data(), &num_bytes,
69 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); 71 MOJO_WRITE_DATA_FLAG_ALL_OR_NONE);
70 DCHECK_EQ(num_bytes, body_[i].size()); 72 DCHECK_EQ(num_bytes, body_[i].size());
71 } 73 }
72 } 74 }
73 75
76 request->originating_time_ticks = originating_time_.ToInternalValue();
77
74 return request.Pass(); 78 return request.Pass();
75 } 79 }
76 80
77 } // namespace web_view 81 } // namespace web_view
OLDNEW
« no previous file with comments | « components/web_view/url_request_cloneable.h ('k') | components/web_view/web_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698