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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 33753005: Fix bug 13827: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 3996 matching lines...) Expand 10 before | Expand all | Expand 10 after
4007 if (line_offset < 0) { 4007 if (line_offset < 0) {
4008 return Api::NewError("%s: argument 'line_offset' must be positive number", 4008 return Api::NewError("%s: argument 'line_offset' must be positive number",
4009 CURRENT_FUNC); 4009 CURRENT_FUNC);
4010 } 4010 }
4011 if (col_offset < 0) { 4011 if (col_offset < 0) {
4012 return Api::NewError("%s: argument 'col_offset' must be positive number", 4012 return Api::NewError("%s: argument 'col_offset' must be positive number",
4013 CURRENT_FUNC); 4013 CURRENT_FUNC);
4014 } 4014 }
4015 CHECK_CALLBACK_STATE(isolate); 4015 CHECK_CALLBACK_STATE(isolate);
4016 4016
4017 NoHeapGrowthControlScope no_growth_control;
4018
4017 library = Library::New(url_str); 4019 library = Library::New(url_str);
4018 library.set_debuggable(true); 4020 library.set_debuggable(true);
4019 library.Register(); 4021 library.Register();
4020 isolate->object_store()->set_root_library(library); 4022 isolate->object_store()->set_root_library(library);
4021 4023
4022 const Script& script = Script::Handle( 4024 const Script& script = Script::Handle(
4023 isolate, Script::New(url_str, source_str, RawScript::kScriptTag)); 4025 isolate, Script::New(url_str, source_str, RawScript::kScriptTag));
4024 script.SetLocationOffset(line_offset, col_offset); 4026 script.SetLocationOffset(line_offset, col_offset);
4025 Dart_Handle result; 4027 Dart_Handle result;
4026 CompileSource(isolate, library, script, &result); 4028 CompileSource(isolate, library, script, &result);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 const String& url_str = Api::UnwrapStringHandle(isolate, url); 4222 const String& url_str = Api::UnwrapStringHandle(isolate, url);
4221 if (url_str.IsNull()) { 4223 if (url_str.IsNull()) {
4222 RETURN_TYPE_ERROR(isolate, url, String); 4224 RETURN_TYPE_ERROR(isolate, url, String);
4223 } 4225 }
4224 const String& source_str = Api::UnwrapStringHandle(isolate, source); 4226 const String& source_str = Api::UnwrapStringHandle(isolate, source);
4225 if (source_str.IsNull()) { 4227 if (source_str.IsNull()) {
4226 RETURN_TYPE_ERROR(isolate, source, String); 4228 RETURN_TYPE_ERROR(isolate, source, String);
4227 } 4229 }
4228 CHECK_CALLBACK_STATE(isolate); 4230 CHECK_CALLBACK_STATE(isolate);
4229 4231
4232 NoHeapGrowthControlScope no_growth_control;
4233
4230 Library& library = Library::Handle(isolate, Library::LookupLibrary(url_str)); 4234 Library& library = Library::Handle(isolate, Library::LookupLibrary(url_str));
4231 if (library.IsNull()) { 4235 if (library.IsNull()) {
4232 library = Library::New(url_str); 4236 library = Library::New(url_str);
4233 library.Register(); 4237 library.Register();
4234 } else if (!library.LoadNotStarted()) { 4238 } else if (!library.LoadNotStarted()) {
4235 // The source for this library has either been loaded or is in the 4239 // The source for this library has either been loaded or is in the
4236 // process of loading. Return an error. 4240 // process of loading. Return an error.
4237 return Api::NewError("%s: library '%s' has already been loaded.", 4241 return Api::NewError("%s: library '%s' has already been loaded.",
4238 CURRENT_FUNC, url_str.ToCString()); 4242 CURRENT_FUNC, url_str.ToCString());
4239 } 4243 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 const String& url_str = Api::UnwrapStringHandle(isolate, url); 4318 const String& url_str = Api::UnwrapStringHandle(isolate, url);
4315 if (url_str.IsNull()) { 4319 if (url_str.IsNull()) {
4316 RETURN_TYPE_ERROR(isolate, url, String); 4320 RETURN_TYPE_ERROR(isolate, url, String);
4317 } 4321 }
4318 const String& source_str = Api::UnwrapStringHandle(isolate, source); 4322 const String& source_str = Api::UnwrapStringHandle(isolate, source);
4319 if (source_str.IsNull()) { 4323 if (source_str.IsNull()) {
4320 RETURN_TYPE_ERROR(isolate, source, String); 4324 RETURN_TYPE_ERROR(isolate, source, String);
4321 } 4325 }
4322 CHECK_CALLBACK_STATE(isolate); 4326 CHECK_CALLBACK_STATE(isolate);
4323 4327
4328 NoHeapGrowthControlScope no_growth_control;
4329
4324 const Script& script = Script::Handle( 4330 const Script& script = Script::Handle(
4325 isolate, Script::New(url_str, source_str, RawScript::kSourceTag)); 4331 isolate, Script::New(url_str, source_str, RawScript::kSourceTag));
4326 Dart_Handle result; 4332 Dart_Handle result;
4327 CompileSource(isolate, lib, script, &result); 4333 CompileSource(isolate, lib, script, &result);
4328 return result; 4334 return result;
4329 } 4335 }
4330 4336
4331 4337
4332 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library, 4338 DART_EXPORT Dart_Handle Dart_LibraryLoadPatch(Dart_Handle library,
4333 Dart_Handle url, 4339 Dart_Handle url,
4334 Dart_Handle patch_source) { 4340 Dart_Handle patch_source) {
4335 TIMERSCOPE(time_script_loading); 4341 TIMERSCOPE(time_script_loading);
4336 Isolate* isolate = Isolate::Current(); 4342 Isolate* isolate = Isolate::Current();
4337 DARTSCOPE(isolate); 4343 DARTSCOPE(isolate);
4338 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); 4344 const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
4339 if (lib.IsNull()) { 4345 if (lib.IsNull()) {
4340 RETURN_TYPE_ERROR(isolate, library, Library); 4346 RETURN_TYPE_ERROR(isolate, library, Library);
4341 } 4347 }
4342 const String& url_str = Api::UnwrapStringHandle(isolate, url); 4348 const String& url_str = Api::UnwrapStringHandle(isolate, url);
4343 if (url_str.IsNull()) { 4349 if (url_str.IsNull()) {
4344 RETURN_TYPE_ERROR(isolate, url, String); 4350 RETURN_TYPE_ERROR(isolate, url, String);
4345 } 4351 }
4346 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source); 4352 const String& source_str = Api::UnwrapStringHandle(isolate, patch_source);
4347 if (source_str.IsNull()) { 4353 if (source_str.IsNull()) {
4348 RETURN_TYPE_ERROR(isolate, patch_source, String); 4354 RETURN_TYPE_ERROR(isolate, patch_source, String);
4349 } 4355 }
4350 CHECK_CALLBACK_STATE(isolate); 4356 CHECK_CALLBACK_STATE(isolate);
4351 4357
4358 NoHeapGrowthControlScope no_growth_control;
4359
4352 const Script& script = Script::Handle( 4360 const Script& script = Script::Handle(
4353 isolate, Script::New(url_str, source_str, RawScript::kPatchTag)); 4361 isolate, Script::New(url_str, source_str, RawScript::kPatchTag));
4354 Dart_Handle result; 4362 Dart_Handle result;
4355 CompileSource(isolate, lib, script, &result); 4363 CompileSource(isolate, lib, script, &result);
4356 return result; 4364 return result;
4357 } 4365 }
4358 4366
4359 4367
4360 DART_EXPORT Dart_Handle Dart_SetNativeResolver( 4368 DART_EXPORT Dart_Handle Dart_SetNativeResolver(
4361 Dart_Handle library, 4369 Dart_Handle library,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 } 4413 }
4406 { 4414 {
4407 NoGCScope no_gc; 4415 NoGCScope no_gc;
4408 RawObject* raw_obj = obj.raw(); 4416 RawObject* raw_obj = obj.raw();
4409 isolate->heap()->SetPeer(raw_obj, peer); 4417 isolate->heap()->SetPeer(raw_obj, peer);
4410 } 4418 }
4411 return Api::Success(); 4419 return Api::Success();
4412 } 4420 }
4413 4421
4414 } // namespace dart 4422 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698