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

Side by Side Diff: runtime/bin/dartutils.cc

Issue 1170503004: Initial Timeline Events (Closed) Base URL: git@github.com:dart-lang/sdk.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 | « no previous file | runtime/bin/isolate_data.h » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
11 #include "platform/globals.h" 11 #include "platform/globals.h"
12 12
13 #include "bin/crypto.h" 13 #include "bin/crypto.h"
14 #include "bin/directory.h" 14 #include "bin/directory.h"
15 #include "bin/extensions.h" 15 #include "bin/extensions.h"
16 #include "bin/file.h" 16 #include "bin/file.h"
17 #include "bin/io_buffer.h" 17 #include "bin/io_buffer.h"
18 #include "bin/isolate_data.h"
18 #include "bin/platform.h" 19 #include "bin/platform.h"
19 #include "bin/socket.h" 20 #include "bin/socket.h"
20 #include "bin/utils.h" 21 #include "bin/utils.h"
21 22
22 namespace dart { 23 namespace dart {
23 namespace bin { 24 namespace bin {
24 25
25 const char* DartUtils::original_working_directory = NULL; 26 const char* DartUtils::original_working_directory = NULL;
26 const char* DartUtils::kDartScheme = "dart:"; 27 const char* DartUtils::kDartScheme = "dart:";
27 const char* DartUtils::kDartExtensionScheme = "dart-ext:"; 28 const char* DartUtils::kDartExtensionScheme = "dart-ext:";
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 480
480 Dart_Handle DartUtils::LoadScript(const char* script_uri, 481 Dart_Handle DartUtils::LoadScript(const char* script_uri,
481 Dart_Handle builtin_lib) { 482 Dart_Handle builtin_lib) {
482 Dart_Handle uri = Dart_NewStringFromCString(script_uri); 483 Dart_Handle uri = Dart_NewStringFromCString(script_uri);
483 484
484 Dart_Port load_port = Dart_ServiceWaitForLoadPort(); 485 Dart_Port load_port = Dart_ServiceWaitForLoadPort();
485 if (load_port == ILLEGAL_PORT) { 486 if (load_port == ILLEGAL_PORT) {
486 return NewDartUnsupportedError("Service did not return load port."); 487 return NewDartUnsupportedError("Service did not return load port.");
487 } 488 }
488 Builtin::SetLoadPort(load_port); 489 Builtin::SetLoadPort(load_port);
489 490 IsolateData* isolate_data =
491 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
492 Dart_TimelineAsyncBegin("LoadScript", &(isolate_data->load_async_id));
490 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null(), builtin_lib); 493 return LoadDataAsync_Invoke(Dart_Null(), uri, Dart_Null(), builtin_lib);
491 } 494 }
492 495
493 496
494 // Callback function, gets called from asynchronous script and library 497 // Callback function, gets called from asynchronous script and library
495 // reading code when there is an i/o error. 498 // reading code when there is an i/o error.
496 void FUNCTION_NAME(Builtin_AsyncLoadError)(Dart_NativeArguments args) { 499 void FUNCTION_NAME(Builtin_AsyncLoadError)(Dart_NativeArguments args) {
497 // Dart_Handle source_uri = Dart_GetNativeArgument(args, 0); 500 // Dart_Handle source_uri = Dart_GetNativeArgument(args, 0);
498 Dart_Handle library_uri = Dart_GetNativeArgument(args, 1); 501 Dart_Handle library_uri = Dart_GetNativeArgument(args, 1);
499 Dart_Handle error = Dart_GetNativeArgument(args, 2); 502 Dart_Handle error = Dart_GetNativeArgument(args, 2);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 if (Dart_IsError(result)) { 587 if (Dart_IsError(result)) {
585 Dart_PropagateError(result); 588 Dart_PropagateError(result);
586 } 589 }
587 } 590 }
588 591
589 592
590 // Callback function that gets called from dartutils when there are 593 // Callback function that gets called from dartutils when there are
591 // no more outstanding load requests. 594 // no more outstanding load requests.
592 void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) { 595 void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) {
593 Dart_Handle res = Dart_FinalizeLoading(true); 596 Dart_Handle res = Dart_FinalizeLoading(true);
597 IsolateData* isolate_data =
598 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
599 if (isolate_data->load_async_id >= 0) {
600 Dart_TimelineAsyncEnd("LoadScript", isolate_data->load_async_id);
601 }
594 if (Dart_IsError(res)) { 602 if (Dart_IsError(res)) {
595 // TODO(hausner): If compilation/loading errors are supposed to 603 // TODO(hausner): If compilation/loading errors are supposed to
596 // be observable by the program, we need to mark the bad library 604 // be observable by the program, we need to mark the bad library
597 // with the error instead of propagating it. 605 // with the error instead of propagating it.
598 Dart_PropagateError(res); 606 Dart_PropagateError(res);
599 } 607 }
600 } 608 }
601 609
602 610
603 void FUNCTION_NAME(Builtin_NativeLibraryExtension)(Dart_NativeArguments args) { 611 void FUNCTION_NAME(Builtin_NativeLibraryExtension)(Dart_NativeArguments args) {
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 new CObjectString(CObject::NewString(os_error->message())); 1213 new CObjectString(CObject::NewString(os_error->message()));
1206 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1214 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1207 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1215 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1208 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1216 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1209 result->SetAt(2, error_message); 1217 result->SetAt(2, error_message);
1210 return result; 1218 return result;
1211 } 1219 }
1212 1220
1213 } // namespace bin 1221 } // namespace bin
1214 } // namespace dart 1222 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698