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

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

Issue 1188433006: Revert of Update Dart dependency and patch dart_controller to account for (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | « DEPS ('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 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 CHECK(!LogIfError(Dart_RunLoop())); 231 CHECK(!LogIfError(Dart_RunLoop()));
232 handle_watcher_started = true; 232 handle_watcher_started = true;
233 } 233 }
234 234
235 // TODO(rafaelw): Right now this only supports the creation of the handle 235 // TODO(rafaelw): Right now this only supports the creation of the handle
236 // watcher isolate and the service isolate. Presumably, we'll want application 236 // watcher isolate and the service isolate. Presumably, we'll want application
237 // isolates to spawn their own isolates. 237 // isolates to spawn their own isolates.
238 static Dart_Isolate IsolateCreateCallback(const char* script_uri, 238 static Dart_Isolate IsolateCreateCallback(const char* script_uri,
239 const char* main, 239 const char* main,
240 const char* package_root, 240 const char* package_root,
241 Dart_IsolateFlags* flags,
242 void* callback_data, 241 void* callback_data,
243 char** error) { 242 char** error) {
244 243
245 if (IsServiceIsolateURL(script_uri)) { 244 if (IsServiceIsolateURL(script_uri)) {
246 CHECK(kDartIsolateSnapshotBuffer); 245 CHECK(kDartIsolateSnapshotBuffer);
247 DartState* dart_state = new DartState(); 246 DartState* dart_state = new DartState();
248 Dart_Isolate isolate = Dart_CreateIsolate(script_uri, 247 Dart_Isolate isolate = Dart_CreateIsolate(script_uri,
249 "main", 248 "main",
250 kDartIsolateSnapshotBuffer, 249 kDartIsolateSnapshotBuffer,
251 nullptr, 250 nullptr,
252 nullptr,
253 error); 251 error);
254 CHECK(isolate) << error; 252 CHECK(isolate) << error;
255 dart_state->SetIsolate(isolate); 253 dart_state->SetIsolate(isolate);
256 CHECK(Dart_IsServiceIsolate(isolate)); 254 CHECK(Dart_IsServiceIsolate(isolate));
257 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); 255 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler)));
258 { 256 {
259 DartApiScope apiScope; 257 DartApiScope apiScope;
260 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 258 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
261 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary); 259 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
262 Builtin::SetNativeResolver(Builtin::kIOLibrary); 260 Builtin::SetNativeResolver(Builtin::kIOLibrary);
(...skipping 10 matching lines...) Expand all
273 } 271 }
274 } 272 }
275 Dart_ExitIsolate(); 273 Dart_ExitIsolate();
276 return isolate; 274 return isolate;
277 } 275 }
278 276
279 // Create & start the handle watcher isolate 277 // Create & start the handle watcher isolate
280 CHECK(kDartIsolateSnapshotBuffer); 278 CHECK(kDartIsolateSnapshotBuffer);
281 DartState* dart_state = new DartState(); 279 DartState* dart_state = new DartState();
282 Dart_Isolate isolate = Dart_CreateIsolate("sky:handle_watcher", "", 280 Dart_Isolate isolate = Dart_CreateIsolate("sky:handle_watcher", "",
283 kDartIsolateSnapshotBuffer, nullptr, dart_state, error); 281 kDartIsolateSnapshotBuffer, dart_state, error);
284 CHECK(isolate) << error; 282 CHECK(isolate) << error;
285 dart_state->SetIsolate(isolate); 283 dart_state->SetIsolate(isolate);
286 284
287 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); 285 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler)));
288 286
289 { 287 {
290 DartApiScope apiScope; 288 DartApiScope apiScope;
291 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 289 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
292 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary); 290 Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
293 Builtin::SetNativeResolver(Builtin::kIOLibrary); 291 Builtin::SetNativeResolver(Builtin::kIOLibrary);
(...skipping 25 matching lines...) Expand all
319 Platform::current()->mainThreadTaskRunner()->PostTask(FROM_HERE, 317 Platform::current()->mainThreadTaskRunner()->PostTask(FROM_HERE,
320 base::Bind(&CallHandleMessage, DartState::From(dest_isolate)->GetWeakPtr() )); 318 base::Bind(&CallHandleMessage, DartState::From(dest_isolate)->GetWeakPtr() ));
321 } 319 }
322 320
323 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state) { 321 void DartController::CreateIsolateFor(PassOwnPtr<DOMDartState> state) {
324 CHECK(kDartIsolateSnapshotBuffer); 322 CHECK(kDartIsolateSnapshotBuffer);
325 char* error = nullptr; 323 char* error = nullptr;
326 dom_dart_state_ = state; 324 dom_dart_state_ = state;
327 Dart_Isolate isolate = Dart_CreateIsolate( 325 Dart_Isolate isolate = Dart_CreateIsolate(
328 dom_dart_state_->url().string().utf8().data(), "main", 326 dom_dart_state_->url().string().utf8().data(), "main",
329 kDartIsolateSnapshotBuffer, nullptr, 327 kDartIsolateSnapshotBuffer,
330 static_cast<DartState*>(dom_dart_state_.get()), &error); 328 static_cast<DartState*>(dom_dart_state_.get()), &error);
331 Dart_SetMessageNotifyCallback(MessageNotifyCallback); 329 Dart_SetMessageNotifyCallback(MessageNotifyCallback);
332 CHECK(isolate) << error; 330 CHECK(isolate) << error;
333 dom_dart_state_->SetIsolate(isolate); 331 dom_dart_state_->SetIsolate(isolate);
334 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue); 332 Dart_SetGcCallbacks(DartGCPrologue, DartGCEpilogue);
335 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler))); 333 CHECK(!LogIfError(Dart_SetLibraryTagHandler(LibraryTagHandler)));
336 334
337 { 335 {
338 DartApiScope apiScope; 336 DartApiScope apiScope;
339 337
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 nullptr, // Isolate interrupt callback. 389 nullptr, // Isolate interrupt callback.
392 UnhandledExceptionCallback, IsolateShutdownCallback, 390 UnhandledExceptionCallback, IsolateShutdownCallback,
393 // File IO callbacks. 391 // File IO callbacks.
394 nullptr, nullptr, nullptr, nullptr, nullptr)); 392 nullptr, nullptr, nullptr, nullptr, nullptr));
395 // Wait for load port- ensures handle watcher and service isolates are 393 // Wait for load port- ensures handle watcher and service isolates are
396 // running. 394 // running.
397 Dart_ServiceWaitForLoadPort(); 395 Dart_ServiceWaitForLoadPort();
398 } 396 }
399 397
400 } // namespace blink 398 } // namespace blink
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698