| OLD | NEW |
| 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 #include "services/dart/content_handler_app.h" | 4 #include "services/dart/content_handler_app.h" |
| 5 | 5 |
| 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_split.h" | 8 #include "base/strings/string_split.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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 mojo::ContentHandlerFactory::GetInterfaceRequestHandler( | 199 mojo::ContentHandlerFactory::GetInterfaceRequestHandler( |
| 200 &strict_content_handler_)); | 200 &strict_content_handler_)); |
| 201 } else { | 201 } else { |
| 202 service_provider_impl->AddService<mojo::ContentHandler>( | 202 service_provider_impl->AddService<mojo::ContentHandler>( |
| 203 mojo::ContentHandlerFactory::GetInterfaceRequestHandler( | 203 mojo::ContentHandlerFactory::GetInterfaceRequestHandler( |
| 204 &content_handler_)); | 204 &content_handler_)); |
| 205 } | 205 } |
| 206 return true; | 206 return true; |
| 207 } | 207 } |
| 208 | 208 |
| 209 scoped_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder> | 209 std::unique_ptr<mojo::ContentHandlerFactory::HandledApplicationHolder> |
| 210 DartContentHandler::CreateApplication( | 210 DartContentHandler::CreateApplication( |
| 211 mojo::InterfaceRequest<mojo::Application> application_request, | 211 mojo::InterfaceRequest<mojo::Application> application_request, |
| 212 mojo::URLResponsePtr response) { | 212 mojo::URLResponsePtr response) { |
| 213 base::trace_event::TraceLog::GetInstance() | 213 base::trace_event::TraceLog::GetInstance() |
| 214 ->SetCurrentThreadBlocksMessageLoop(); | 214 ->SetCurrentThreadBlocksMessageLoop(); |
| 215 | 215 |
| 216 TRACE_EVENT1("dart_content_handler", "DartContentHandler::CreateApplication", | 216 TRACE_EVENT1("dart_content_handler", "DartContentHandler::CreateApplication", |
| 217 "url", response->url.get()); | 217 "url", response->url.get()); |
| 218 | 218 |
| 219 const bool run_on_message_loop = app_->run_on_message_loop(); | 219 const bool run_on_message_loop = app_->run_on_message_loop(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 237 handler_task_runner_->PostTask( | 237 handler_task_runner_->PostTask( |
| 238 FROM_HERE, | 238 FROM_HERE, |
| 239 base::Bind( | 239 base::Bind( |
| 240 &DartContentHandlerApp::ExtractApplication, base::Unretained(app_), | 240 &DartContentHandlerApp::ExtractApplication, base::Unretained(app_), |
| 241 base::Unretained(&application_dir), base::Passed(response.Pass()), | 241 base::Unretained(&application_dir), base::Passed(response.Pass()), |
| 242 base::Bind( | 242 base::Bind( |
| 243 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), | 243 base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask), |
| 244 base::MessageLoop::current()->task_runner(), FROM_HERE, | 244 base::MessageLoop::current()->task_runner(), FROM_HERE, |
| 245 base::MessageLoop::QuitWhenIdleClosure()))); | 245 base::MessageLoop::QuitWhenIdleClosure()))); |
| 246 base::RunLoop().Run(); | 246 base::RunLoop().Run(); |
| 247 return make_scoped_ptr( | 247 return std::unique_ptr< |
| 248 mojo::ContentHandlerFactory::HandledApplicationHolder>( |
| 248 new DartApp(application_request.Pass(), url, application_dir, strict_, | 249 new DartApp(application_request.Pass(), url, application_dir, strict_, |
| 249 run_on_message_loop, override_pause_isolates_flags, | 250 run_on_message_loop, override_pause_isolates_flags, |
| 250 pause_isolates_on_start, pause_isolates_on_exit)); | 251 pause_isolates_on_start, pause_isolates_on_exit)); |
| 251 } else { | 252 } else { |
| 252 // Loading a raw .dart file pointed at by |url|. | 253 // Loading a raw .dart file pointed at by |url|. |
| 253 return make_scoped_ptr( | 254 return std::unique_ptr< |
| 255 mojo::ContentHandlerFactory::HandledApplicationHolder>( |
| 254 new DartApp(application_request.Pass(), url, strict_, | 256 new DartApp(application_request.Pass(), url, strict_, |
| 255 run_on_message_loop, override_pause_isolates_flags, | 257 run_on_message_loop, override_pause_isolates_flags, |
| 256 pause_isolates_on_start, pause_isolates_on_exit)); | 258 pause_isolates_on_start, pause_isolates_on_exit)); |
| 257 } | 259 } |
| 258 } | 260 } |
| 259 | 261 |
| 260 } // namespace dart | 262 } // namespace dart |
| OLD | NEW |