| 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 | 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_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 10 matching lines...) Expand all Loading... |
| 21 #include "mojo/services/tracing/interfaces/tracing.mojom.h" | 21 #include "mojo/services/tracing/interfaces/tracing.mojom.h" |
| 22 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac
he.mojom.h" | 22 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac
he.mojom.h" |
| 23 #include "services/dart/content_handler_app_service_connector.h" | 23 #include "services/dart/content_handler_app_service_connector.h" |
| 24 #include "services/dart/dart_app.h" | 24 #include "services/dart/dart_app.h" |
| 25 #include "services/dart/dart_tracing.h" | 25 #include "services/dart/dart_tracing.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 namespace dart { | 28 namespace dart { |
| 29 | 29 |
| 30 const char kCompleteTimeline[] = "--complete-timeline"; | 30 const char kCompleteTimeline[] = "--complete-timeline"; |
| 31 const char kDartTimeline[] = "--dart-timeline"; |
| 31 const char kEnableStrictMode[] = "--enable-strict-mode"; | 32 const char kEnableStrictMode[] = "--enable-strict-mode"; |
| 32 const char kDisableObservatory[] = "--disable-observatory"; | 33 const char kDisableObservatory[] = "--disable-observatory"; |
| 33 const char kTraceStartup[] = "--trace-startup"; | 34 const char kTraceStartup[] = "--trace-startup"; |
| 34 const char kRunOnMessageLoop[] = "--run-on-message-loop"; | 35 const char kRunOnMessageLoop[] = "--run-on-message-loop"; |
| 35 | 36 |
| 36 static bool IsDartZip(std::string url) { | 37 static bool IsDartZip(std::string url) { |
| 37 // If the url doesn't end with ".dart" we assume it is a zipped up | 38 // If the url doesn't end with ".dart" we assume it is a zipped up |
| 38 // dart application. | 39 // dart application. |
| 39 return !base::EndsWith(url, ".dart", base::CompareCase::INSENSITIVE_ASCII); | 40 return !base::EndsWith(url, ".dart", base::CompareCase::INSENSITIVE_ASCII); |
| 40 } | 41 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if (app->HasArg(kCompleteTimeline)) { | 133 if (app->HasArg(kCompleteTimeline)) { |
| 133 timeline_arg = kCompleteTimeline; | 134 timeline_arg = kCompleteTimeline; |
| 134 timeline_arg_count = 1; | 135 timeline_arg_count = 1; |
| 135 } | 136 } |
| 136 | 137 |
| 137 bool observatory_enabled = true; | 138 bool observatory_enabled = true; |
| 138 if (app->HasArg(kDisableObservatory)) { | 139 if (app->HasArg(kDisableObservatory)) { |
| 139 observatory_enabled = false; | 140 observatory_enabled = false; |
| 140 } | 141 } |
| 141 | 142 |
| 143 bool enable_dart_timeline = false; |
| 144 if (app->HasArg(kDartTimeline)) { |
| 145 enable_dart_timeline = true; |
| 146 } |
| 147 |
| 142 bool success = mojo::dart::DartController::Initialize( | 148 bool success = mojo::dart::DartController::Initialize( |
| 143 service_connector_, | 149 service_connector_, |
| 144 default_strict_, | 150 default_strict_, |
| 145 observatory_enabled, | 151 observatory_enabled, |
| 152 enable_dart_timeline, |
| 146 &timeline_arg, | 153 &timeline_arg, |
| 147 timeline_arg_count); | 154 timeline_arg_count); |
| 148 | 155 |
| 149 if (app->HasArg(kTraceStartup)) { | 156 if (app->HasArg(kTraceStartup)) { |
| 150 DartTimelineController::EnableAll(); | 157 DartTimelineController::EnableAll(); |
| 151 } | 158 } |
| 152 if (!success) { | 159 if (!success) { |
| 153 LOG(ERROR) << "Dart VM Initialization failed"; | 160 LOG(ERROR) << "Dart VM Initialization failed"; |
| 154 } | 161 } |
| 155 } | 162 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 run_on_message_loop)); | 249 run_on_message_loop)); |
| 243 } | 250 } |
| 244 } | 251 } |
| 245 | 252 |
| 246 } // namespace dart | 253 } // namespace dart |
| 247 | 254 |
| 248 MojoResult MojoMain(MojoHandle application_request) { | 255 MojoResult MojoMain(MojoHandle application_request) { |
| 249 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp); | 256 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp); |
| 250 return runner.Run(application_request); | 257 return runner.Run(application_request); |
| 251 } | 258 } |
| OLD | NEW |