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

Side by Side Diff: services/dart/content_handler_main.cc

Issue 1272573005: Add more tracing for content handlers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 4 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 | « mojo/application/content_handler_factory.cc ('k') | no next file » | 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 application_dir_path.size())); 83 application_dir_path.size()));
84 } 84 }
85 callback.Run(); 85 callback.Run();
86 }); 86 });
87 } 87 }
88 88
89 private: 89 private:
90 // Overridden from mojo::ApplicationDelegate: 90 // Overridden from mojo::ApplicationDelegate:
91 void Initialize(mojo::ApplicationImpl* app) override { 91 void Initialize(mojo::ApplicationImpl* app) override {
92 tracing_.Initialize(app); 92 tracing_.Initialize(app);
93
94 // TODO(qsr): This has no effect for now, as the tracing infrastructure
95 // doesn't allow to trace anything before the tracing app connects to the
96 // application.
97 TRACE_EVENT0("dart_content_handler", "DartContentHandler::Initialize");
98
93 mojo::icu::Initialize(app); 99 mojo::icu::Initialize(app);
94 content_handler_.set_handler_task_runner( 100 content_handler_.set_handler_task_runner(
95 base::MessageLoop::current()->task_runner()); 101 base::MessageLoop::current()->task_runner());
96 strict_content_handler_.set_handler_task_runner( 102 strict_content_handler_.set_handler_task_runner(
97 base::MessageLoop::current()->task_runner()); 103 base::MessageLoop::current()->task_runner());
98 app->ConnectToService("mojo:url_response_disk_cache", 104 app->ConnectToService("mojo:url_response_disk_cache",
99 &url_response_disk_cache_); 105 &url_response_disk_cache_);
100 service_connector_ = new ContentHandlerAppServiceConnector(app); 106 service_connector_ = new ContentHandlerAppServiceConnector(app);
101 bool success = 107 bool success =
102 mojo::dart::DartController::Initialize(service_connector_, false); 108 mojo::dart::DartController::Initialize(service_connector_, false);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 153
148 DISALLOW_COPY_AND_ASSIGN(DartContentHandlerApp); 154 DISALLOW_COPY_AND_ASSIGN(DartContentHandlerApp);
149 }; 155 };
150 156
151 scoped_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder> 157 scoped_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder>
152 DartContentHandler::CreateApplication( 158 DartContentHandler::CreateApplication(
153 mojo::InterfaceRequest<mojo::Application> application_request, 159 mojo::InterfaceRequest<mojo::Application> application_request,
154 mojo::URLResponsePtr response) { 160 mojo::URLResponsePtr response) {
155 base::trace_event::TraceLog::GetInstance() 161 base::trace_event::TraceLog::GetInstance()
156 ->SetCurrentThreadBlocksMessageLoop(); 162 ->SetCurrentThreadBlocksMessageLoop();
163
164 TRACE_EVENT1("dart_content_handler", "DartContentHandler::CreateApplication",
165 "url", response->url.get());
166
157 base::FilePath application_dir; 167 base::FilePath application_dir;
158 std::string url = response->url.get(); 168 std::string url = response->url.get();
159 if (IsDartZip(response->url.get())) { 169 if (IsDartZip(response->url.get())) {
160 // Loading a .dartzip: 170 // Loading a .dartzip:
161 // 1) Extract the .dartzip 171 // 1) Extract the .dartzip
162 // 2) Launch from temporary directory (|application_dir|). 172 // 2) Launch from temporary directory (|application_dir|).
163 handler_task_runner_->PostTask( 173 handler_task_runner_->PostTask(
164 FROM_HERE, 174 FROM_HERE,
165 base::Bind( 175 base::Bind(
166 &DartContentHandlerApp::ExtractApplication, base::Unretained(app_), 176 &DartContentHandlerApp::ExtractApplication, base::Unretained(app_),
(...skipping 14 matching lines...) Expand all
181 191
182 } // namespace dart 192 } // namespace dart
183 193
184 MojoResult MojoMain(MojoHandle application_request) { 194 MojoResult MojoMain(MojoHandle application_request) {
185 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp); 195 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp);
186 MojoResult r = runner.Run(application_request); 196 MojoResult r = runner.Run(application_request);
187 // TODO(johnmccutchan): Remove this once the Dart VM shuts down threads. 197 // TODO(johnmccutchan): Remove this once the Dart VM shuts down threads.
188 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); 198 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
189 return r; 199 return r;
190 } 200 }
OLDNEW
« no previous file with comments | « mojo/application/content_handler_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698