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

Side by Side Diff: components/html_viewer/html_document.cc

Issue 1421483003: mandoline: Start adding trace events for mandoline stuff. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT 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/font_service/public/cpp/font_loader.cc ('k') | components/html_viewer/html_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 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"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 connection->AddService<mus::mojom::WindowTreeClient>(this); 110 connection->AddService<mus::mojom::WindowTreeClient>(this);
111 connection->AddService<devtools_service::DevToolsAgent>(this); 111 connection->AddService<devtools_service::DevToolsAgent>(this);
112 if (IsTestInterfaceEnabled()) 112 if (IsTestInterfaceEnabled())
113 connection->AddService<TestHTMLViewer>(this); 113 connection->AddService<TestHTMLViewer>(this);
114 114
115 resource_waiter_.reset( 115 resource_waiter_.reset(
116 new DocumentResourceWaiter(global_state_, response.Pass(), this)); 116 new DocumentResourceWaiter(global_state_, response.Pass(), this));
117 } 117 }
118 118
119 void HTMLDocument::Destroy() { 119 void HTMLDocument::Destroy() {
120 TRACE_EVENT0("html_viewer", "HTMLDocument::Destroy");
120 if (resource_waiter_) { 121 if (resource_waiter_) {
121 mus::Window* root = resource_waiter_->root(); 122 mus::Window* root = resource_waiter_->root();
122 if (root) { 123 if (root) {
123 resource_waiter_.reset(); 124 resource_waiter_.reset();
124 delete root->connection(); 125 delete root->connection();
125 } else { 126 } else {
126 delete this; 127 delete this;
127 } 128 }
128 } else if (frame_) { 129 } else if (frame_) {
129 // Closing the frame ends up destroying the ViewManager, which triggers 130 // Closing the frame ends up destroying the ViewManager, which triggers
(...skipping 10 matching lines...) Expand all
140 } 141 }
141 } 142 }
142 143
143 HTMLDocument::~HTMLDocument() { 144 HTMLDocument::~HTMLDocument() {
144 delete_callback_.Run(this); 145 delete_callback_.Run(this);
145 146
146 STLDeleteElements(&ax_providers_); 147 STLDeleteElements(&ax_providers_);
147 } 148 }
148 149
149 void HTMLDocument::Load() { 150 void HTMLDocument::Load() {
151 TRACE_EVENT0("html_viewer", "HTMLDocument::Load");
150 DCHECK(resource_waiter_ && resource_waiter_->is_ready()); 152 DCHECK(resource_waiter_ && resource_waiter_->is_ready());
151 153
152 // Note: |window| is null if we're taking over for an existing frame. 154 // Note: |window| is null if we're taking over for an existing frame.
153 mus::Window* window = resource_waiter_->root(); 155 mus::Window* window = resource_waiter_->root();
154 if (window) { 156 if (window) {
155 global_state_->InitIfNecessary( 157 global_state_->InitIfNecessary(
156 window->viewport_metrics().size_in_pixels.To<gfx::Size>(), 158 window->viewport_metrics().size_in_pixels.To<gfx::Size>(),
157 window->viewport_metrics().device_pixel_ratio); 159 window->viewport_metrics().device_pixel_ratio);
158 } 160 }
159 161
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 void HTMLDocument::OnEmbed(Window* root) { 203 void HTMLDocument::OnEmbed(Window* root) {
202 transferable_state_.root = root; 204 transferable_state_.root = root;
203 resource_waiter_->SetRoot(root); 205 resource_waiter_->SetRoot(root);
204 } 206 }
205 207
206 void HTMLDocument::OnConnectionLost(mus::WindowTreeConnection* connection) { 208 void HTMLDocument::OnConnectionLost(mus::WindowTreeConnection* connection) {
207 delete this; 209 delete this;
208 } 210 }
209 211
210 void HTMLDocument::OnFrameDidFinishLoad() { 212 void HTMLDocument::OnFrameDidFinishLoad() {
213 TRACE_EVENT0("html_viewer", "HTMLDocument::OnFrameDidFinishLoad");
211 did_finish_local_frame_load_ = true; 214 did_finish_local_frame_load_ = true;
212 scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass(); 215 scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass();
213 if (!before_load_cache) 216 if (!before_load_cache)
214 return; 217 return;
215 218
216 // Bind any pending AxProvider and TestHTMLViewer interface requests. 219 // Bind any pending AxProvider and TestHTMLViewer interface requests.
217 for (auto it : before_load_cache->ax_provider_requests) { 220 for (auto it : before_load_cache->ax_provider_requests) {
218 ax_providers_.insert(new AxProviderImpl( 221 ax_providers_.insert(new AxProviderImpl(
219 frame_->frame_tree_manager()->GetWebView(), it->Pass())); 222 frame_->frame_tree_manager()->GetWebView(), it->Pass()));
220 } 223 }
(...skipping 12 matching lines...) Expand all
233 return factory_; 236 return factory_;
234 } 237 }
235 238
236 void HTMLDocument::OnFrameSwappedToRemote() { 239 void HTMLDocument::OnFrameSwappedToRemote() {
237 // When the frame becomes remote HTMLDocument is no longer needed. 240 // When the frame becomes remote HTMLDocument is no longer needed.
238 frame_ = nullptr; 241 frame_ = nullptr;
239 Destroy(); 242 Destroy();
240 } 243 }
241 244
242 void HTMLDocument::OnSwap(HTMLFrame* frame, HTMLFrameDelegate* old_delegate) { 245 void HTMLDocument::OnSwap(HTMLFrame* frame, HTMLFrameDelegate* old_delegate) {
246 TRACE_EVENT0("html_viewer", "HTMLDocument::OnSwap");
243 DCHECK(frame->IsLocal()); 247 DCHECK(frame->IsLocal());
244 DCHECK(frame->window()); 248 DCHECK(frame->window());
245 DCHECK(!frame_); 249 DCHECK(!frame_);
246 DCHECK(!transferable_state_.root); 250 DCHECK(!transferable_state_.root);
247 if (!old_delegate) { 251 if (!old_delegate) {
248 // We're taking over a child of a local root that isn't associated with a 252 // We're taking over a child of a local root that isn't associated with a
249 // delegate. In this case the frame's window is not the root of the 253 // delegate. In this case the frame's window is not the root of the
250 // WindowTreeConnection. 254 // WindowTreeConnection.
251 transferable_state_.owns_window_tree_connection = false; 255 transferable_state_.owns_window_tree_connection = false;
252 transferable_state_.root = frame->window(); 256 transferable_state_.root = frame->window();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 DCHECK(!transferable_state_.window_tree_delegate_impl); 322 DCHECK(!transferable_state_.window_tree_delegate_impl);
319 transferable_state_.window_tree_delegate_impl.reset( 323 transferable_state_.window_tree_delegate_impl.reset(
320 new WindowTreeDelegateImpl(this)); 324 new WindowTreeDelegateImpl(this));
321 transferable_state_.owns_window_tree_connection = true; 325 transferable_state_.owns_window_tree_connection = true;
322 mus::WindowTreeConnection::Create( 326 mus::WindowTreeConnection::Create(
323 transferable_state_.window_tree_delegate_impl.get(), request.Pass(), 327 transferable_state_.window_tree_delegate_impl.get(), request.Pass(),
324 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); 328 mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
325 } 329 }
326 330
327 } // namespace html_viewer 331 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/font_service/public/cpp/font_loader.cc ('k') | components/html_viewer/html_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698