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

Side by Side Diff: components/web_view/frame.h

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/html_viewer/html_frame_apptest.cc ('k') | components/web_view/frame.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 #ifndef COMPONENTS_WEB_VIEW_FRAME_H_ 5 #ifndef COMPONENTS_WEB_VIEW_FRAME_H_
6 #define COMPONENTS_WEB_VIEW_FRAME_H_ 6 #define COMPONENTS_WEB_VIEW_FRAME_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/time/time.h"
13 #include "components/mus/public/cpp/types.h" 14 #include "components/mus/public/cpp/types.h"
14 #include "components/mus/public/cpp/view_observer.h" 15 #include "components/mus/public/cpp/view_observer.h"
15 #include "components/web_view/public/interfaces/frame.mojom.h" 16 #include "components/web_view/public/interfaces/frame.mojom.h"
16 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" 17 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
17 18
18 class GURL; 19 class GURL;
19 20
20 namespace web_view { 21 namespace web_view {
21 22
22 class FrameTest; 23 class FrameTest;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 uint32_t frame_id, 62 uint32_t frame_id,
62 uint32_t app_id, 63 uint32_t app_id,
63 ViewOwnership view_ownership, 64 ViewOwnership view_ownership,
64 mojom::FrameClient* frame_client, 65 mojom::FrameClient* frame_client,
65 scoped_ptr<FrameUserData> user_data, 66 scoped_ptr<FrameUserData> user_data,
66 const ClientPropertyMap& client_properties); 67 const ClientPropertyMap& client_properties);
67 ~Frame() override; 68 ~Frame() override;
68 69
69 void Init(Frame* parent, 70 void Init(Frame* parent,
70 mojo::ViewTreeClientPtr view_tree_client, 71 mojo::ViewTreeClientPtr view_tree_client,
71 mojo::InterfaceRequest<mojom::Frame> frame_request); 72 mojo::InterfaceRequest<mojom::Frame> frame_request,
73 base::TimeTicks navigation_start_time);
72 74
73 // Walks the View tree starting at |view| going up returning the first 75 // Walks the View tree starting at |view| going up returning the first
74 // Frame that is associated with |view|. For example, if |view| 76 // Frame that is associated with |view|. For example, if |view|
75 // has a Frame associated with it, then that is returned. Otherwise 77 // has a Frame associated with it, then that is returned. Otherwise
76 // this checks view->parent() and so on. 78 // this checks view->parent() and so on.
77 static Frame* FindFirstFrameAncestor(mus::View* view); 79 static Frame* FindFirstFrameAncestor(mus::View* view);
78 80
79 FrameTree* tree() { return tree_; } 81 FrameTree* tree() { return tree_; }
80 82
81 Frame* parent() { return parent_; } 83 Frame* parent() { return parent_; }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // and is destroyed after the connection responds to OnConnect(). 153 // and is destroyed after the connection responds to OnConnect().
152 // 154 //
153 // If |client_type| is SAME_APP we can't destroy the existing client 155 // If |client_type| is SAME_APP we can't destroy the existing client
154 // (and related data) until we get back the ack from OnConnect(). This way 156 // (and related data) until we get back the ack from OnConnect(). This way
155 // we know the client has completed the switch. If we did not do this it 157 // we know the client has completed the switch. If we did not do this it
156 // would be possible for the app to see it's existing Frame connection lost 158 // would be possible for the app to see it's existing Frame connection lost
157 // (and assume the frame is being torn down) before the OnConnect(). 159 // (and assume the frame is being torn down) before the OnConnect().
158 void InitClient(ClientType client_type, 160 void InitClient(ClientType client_type,
159 scoped_ptr<FrameUserDataAndBinding> data_and_binding, 161 scoped_ptr<FrameUserDataAndBinding> data_and_binding,
160 mojo::ViewTreeClientPtr view_tree_client, 162 mojo::ViewTreeClientPtr view_tree_client,
161 mojo::InterfaceRequest<mojom::Frame> frame_request); 163 mojo::InterfaceRequest<mojom::Frame> frame_request,
164 base::TimeTicks navigation_start_time);
162 165
163 // Callback from OnConnect(). This does nothing (other than destroying 166 // Callback from OnConnect(). This does nothing (other than destroying
164 // |data_and_binding|). See InitClient() for details as to why destruction of 167 // |data_and_binding|). See InitClient() for details as to why destruction of
165 // |data_and_binding| happens after OnConnect(). 168 // |data_and_binding| happens after OnConnect().
166 static void OnConnectAck( 169 static void OnConnectAck(
167 scoped_ptr<FrameUserDataAndBinding> data_and_binding); 170 scoped_ptr<FrameUserDataAndBinding> data_and_binding);
168 171
169 // Callback from OnEmbed(). 172 // Callback from OnEmbed().
170 void OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id); 173 void OnEmbedAck(bool success, mus::ConnectionSpecificId connection_id);
171 174
172 // Callback from Frame::OnWillNavigate(). Completes navigation. 175 // Callback from Frame::OnWillNavigate(). Completes navigation.
173 void OnWillNavigateAck(mojom::FrameClient* frame_client, 176 void OnWillNavigateAck(mojom::FrameClient* frame_client,
174 scoped_ptr<FrameUserData> user_data, 177 scoped_ptr<FrameUserData> user_data,
175 mojo::ViewTreeClientPtr view_tree_client, 178 mojo::ViewTreeClientPtr view_tree_client,
176 uint32 app_id); 179 uint32 app_id,
180 base::TimeTicks navigation_start_time);
177 181
178 // Completes a navigation request; swapping the existing FrameClient to the 182 // Completes a navigation request; swapping the existing FrameClient to the
179 // supplied arguments. 183 // supplied arguments.
180 void ChangeClient(mojom::FrameClient* frame_client, 184 void ChangeClient(mojom::FrameClient* frame_client,
181 scoped_ptr<FrameUserData> user_data, 185 scoped_ptr<FrameUserData> user_data,
182 mojo::ViewTreeClientPtr view_tree_client, 186 mojo::ViewTreeClientPtr view_tree_client,
183 uint32 app_id); 187 uint32 app_id,
188 base::TimeTicks navigation_start_time);
184 189
185 void SetView(mus::View* view); 190 void SetView(mus::View* view);
186 191
187 // Adds this to |frames| and recurses through the children calling the 192 // Adds this to |frames| and recurses through the children calling the
188 // same function. 193 // same function.
189 void BuildFrameTree(std::vector<const Frame*>* frames) const; 194 void BuildFrameTree(std::vector<const Frame*>* frames) const;
190 195
191 void Add(Frame* node); 196 void Add(Frame* node);
192 void Remove(Frame* node); 197 void Remove(Frame* node);
193 198
194 // Starts a new navigation to |request|. The navigation proceeds as long 199 // Starts a new navigation to |request|. The navigation proceeds as long
195 // as there is a View and once OnWillNavigate() has returned. If there is 200 // as there is a View and once OnWillNavigate() has returned. If there is
196 // no View the navigation waits until the View is available. 201 // no View the navigation waits until the View is available.
197 void StartNavigate(mojo::URLRequestPtr request); 202 void StartNavigate(mojo::URLRequestPtr request);
198 void OnCanNavigateFrame(const GURL& url, 203 void OnCanNavigateFrame(const GURL& url,
204 base::TimeTicks navigation_start_time,
199 uint32_t app_id, 205 uint32_t app_id,
200 mojom::FrameClient* frame_client, 206 mojom::FrameClient* frame_client,
201 scoped_ptr<FrameUserData> user_data, 207 scoped_ptr<FrameUserData> user_data,
202 mojo::ViewTreeClientPtr view_tree_client); 208 mojo::ViewTreeClientPtr view_tree_client);
203 209
204 // Notifies the client and all descendants as appropriate. 210 // Notifies the client and all descendants as appropriate.
205 void NotifyAdded(const Frame* source, 211 void NotifyAdded(const Frame* source,
206 const Frame* added_node, 212 const Frame* added_node,
207 uint32_t change_id); 213 uint32_t change_id);
208 void NotifyRemoved(const Frame* source, 214 void NotifyRemoved(const Frame* source,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_; 283 base::WeakPtrFactory<Frame> embed_weak_ptr_factory_;
278 284
279 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_; 285 base::WeakPtrFactory<Frame> navigate_weak_ptr_factory_;
280 286
281 DISALLOW_COPY_AND_ASSIGN(Frame); 287 DISALLOW_COPY_AND_ASSIGN(Frame);
282 }; 288 };
283 289
284 } // namespace web_view 290 } // namespace web_view
285 291
286 #endif // COMPONENTS_WEB_VIEW_FRAME_H_ 292 #endif // COMPONENTS_WEB_VIEW_FRAME_H_
OLDNEW
« no previous file with comments | « components/html_viewer/html_frame_apptest.cc ('k') | components/web_view/frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698