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

Side by Side Diff: sky/engine/core/script/dart_controller.cc

Issue 1027603002: Dart: Removes all but native calls and the handle watcher from the snapshot. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Hoist application interface dependence Created 5 years, 9 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 | « sky/engine/bindings/snapshot.dart ('k') | sky/framework/embedder.dart » ('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 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/script/dart_controller.h" 6 #include "sky/engine/core/script/dart_controller.h"
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 Dart_Isolate isolate = Dart_CreateIsolate("sky:handle_watcher", "", 192 Dart_Isolate isolate = Dart_CreateIsolate("sky:handle_watcher", "",
193 kDartSnapshotBuffer, dart_state, error); 193 kDartSnapshotBuffer, dart_state, error);
194 CHECK(isolate) << error; 194 CHECK(isolate) << error;
195 dart_state->set_isolate(isolate); 195 dart_state->set_isolate(isolate);
196 196
197 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); 197 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler)));
198 198
199 { 199 {
200 DartApiScope apiScope; 200 DartApiScope apiScope;
201 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 201 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
202 Builtin::SetNativeResolver(Builtin::kMojoCoreLibrary); 202 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
203 } 203 }
204 204
205 Dart_ExitIsolate(); 205 Dart_ExitIsolate();
206 206
207 CHECK(Dart_IsolateMakeRunnable(isolate)); 207 CHECK(Dart_IsolateMakeRunnable(isolate));
208 return isolate; 208 return isolate;
209 } 209 }
210 210
211 static void CallHandleMessage(base::WeakPtr<DartState> dart_state) { 211 static void CallHandleMessage(base::WeakPtr<DartState> dart_state) {
212 if (!dart_state) 212 if (!dart_state)
(...skipping 11 matching lines...) Expand all
224 } 224 }
225 225
226 static void EnsureHandleWatcherStarted() { 226 static void EnsureHandleWatcherStarted() {
227 static bool handle_watcher_started = false; 227 static bool handle_watcher_started = false;
228 if (handle_watcher_started) 228 if (handle_watcher_started)
229 return; 229 return;
230 230
231 // TODO(dart): Call Dart_Cleanup (ensure the handle watcher isolate is closed) 231 // TODO(dart): Call Dart_Cleanup (ensure the handle watcher isolate is closed)
232 // during shutdown. 232 // during shutdown.
233 Dart_Handle mojo_core_lib = 233 Dart_Handle mojo_core_lib =
234 Builtin::LoadAndCheckLibrary(Builtin::kMojoCoreLibrary); 234 Builtin::LoadAndCheckLibrary(Builtin::kMojoInternalLibrary);
235 CHECK(!LogIfError((mojo_core_lib))); 235 CHECK(!LogIfError((mojo_core_lib)));
236 Dart_Handle handle_watcher_type = Dart_GetType( 236 Dart_Handle handle_watcher_type = Dart_GetType(
237 mojo_core_lib, 237 mojo_core_lib,
238 Dart_NewStringFromCString("MojoHandleWatcher"), 238 Dart_NewStringFromCString("MojoHandleWatcher"),
239 0, 239 0,
240 nullptr); 240 nullptr);
241 CHECK(!LogIfError(handle_watcher_type)); 241 CHECK(!LogIfError(handle_watcher_type));
242 CHECK(!LogIfError(Dart_Invoke( 242 CHECK(!LogIfError(Dart_Invoke(
243 handle_watcher_type, 243 handle_watcher_type,
244 Dart_NewStringFromCString("_start"), 244 Dart_NewStringFromCString("_start"),
(...skipping 16 matching lines...) Expand all
261 Dart_SetMessageNotifyCallback(MessageNotifyCallback); 261 Dart_SetMessageNotifyCallback(MessageNotifyCallback);
262 CHECK(isolate) << error; 262 CHECK(isolate) << error;
263 dom_dart_state_->set_isolate(isolate); 263 dom_dart_state_->set_isolate(isolate);
264 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue); 264 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue);
265 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); 265 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler)));
266 266
267 { 267 {
268 DartApiScope apiScope; 268 DartApiScope apiScope;
269 269
270 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 270 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
271 Builtin::SetNativeResolver(Builtin::kMojoCoreLibrary); 271 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
272 BuiltinNatives::Init(); 272 BuiltinNatives::Init();
273 273
274 builtin_sky_ = adoptPtr(new BuiltinSky(dart_state())); 274 builtin_sky_ = adoptPtr(new BuiltinSky(dart_state()));
275 dart_state()->class_library().set_provider(builtin_sky_.get()); 275 dart_state()->class_library().set_provider(builtin_sky_.get());
276 builtin_sky_->InstallWindow(dart_state()); 276 builtin_sky_->InstallWindow(dart_state());
277 277
278 document->frame()->loaderClient()->didCreateIsolate(isolate); 278 document->frame()->loaderClient()->didCreateIsolate(isolate);
279 279
280 EnsureHandleWatcherStarted(); 280 EnsureHandleWatcherStarted();
281 } 281 }
(...skipping 18 matching lines...) Expand all
300 300
301 CHECK(Dart_SetVMFlags(argc, argv)); 301 CHECK(Dart_SetVMFlags(argc, argv));
302 CHECK(Dart_Initialize(IsolateCreateCallback, 302 CHECK(Dart_Initialize(IsolateCreateCallback,
303 nullptr, // Isolate interrupt callback. 303 nullptr, // Isolate interrupt callback.
304 UnhandledExceptionCallback, IsolateShutdownCallback, 304 UnhandledExceptionCallback, IsolateShutdownCallback,
305 // File IO callbacks. 305 // File IO callbacks.
306 nullptr, nullptr, nullptr, nullptr, nullptr)); 306 nullptr, nullptr, nullptr, nullptr, nullptr));
307 } 307 }
308 308
309 } // namespace blink 309 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings/snapshot.dart ('k') | sky/framework/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698