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

Side by Side Diff: src/api.cc

Issue 223653003: Return MaybeHandle from NewExternalStringFrom*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5452 matching lines...) Expand 10 before | Expand all | Expand 10 after
5463 right_string); 5463 right_string);
5464 // We do not expect this to fail. Change this if it does. 5464 // We do not expect this to fail. Change this if it does.
5465 CHECK(!result.is_null()); 5465 CHECK(!result.is_null());
5466 return Utils::ToLocal(result); 5466 return Utils::ToLocal(result);
5467 } 5467 }
5468 5468
5469 5469
5470 static i::Handle<i::String> NewExternalStringHandle( 5470 static i::Handle<i::String> NewExternalStringHandle(
5471 i::Isolate* isolate, 5471 i::Isolate* isolate,
5472 v8::String::ExternalStringResource* resource) { 5472 v8::String::ExternalStringResource* resource) {
5473 i::Handle<i::String> result =
5474 isolate->factory()->NewExternalStringFromTwoByte(resource);
5475 // We do not expect this to fail. Change this if it does. 5473 // We do not expect this to fail. Change this if it does.
5476 CHECK(!result.is_null()); 5474 return isolate->factory()->NewExternalStringFromTwoByte(
5477 return result; 5475 resource).ToHandleChecked();
5478 } 5476 }
5479 5477
5480 5478
5481 static i::Handle<i::String> NewExternalAsciiStringHandle( 5479 static i::Handle<i::String> NewExternalAsciiStringHandle(
5482 i::Isolate* isolate, 5480 i::Isolate* isolate,
5483 v8::String::ExternalAsciiStringResource* resource) { 5481 v8::String::ExternalAsciiStringResource* resource) {
5484 i::Handle<i::String> result =
5485 isolate->factory()->NewExternalStringFromAscii(resource);
5486 // We do not expect this to fail. Change this if it does. 5482 // We do not expect this to fail. Change this if it does.
5487 CHECK(!result.is_null()); 5483 return isolate->factory()->NewExternalStringFromAscii(
5488 return result; 5484 resource).ToHandleChecked();
5489 } 5485 }
5490 5486
5491 5487
5492 Local<String> v8::String::NewExternal( 5488 Local<String> v8::String::NewExternal(
5493 Isolate* isolate, 5489 Isolate* isolate,
5494 v8::String::ExternalStringResource* resource) { 5490 v8::String::ExternalStringResource* resource) {
5495 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 5491 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5496 EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()"); 5492 EnsureInitializedForIsolate(i_isolate, "v8::String::NewExternal()");
5497 LOG_API(i_isolate, "String::NewExternal"); 5493 LOG_API(i_isolate, "String::NewExternal");
5498 ENTER_V8(i_isolate); 5494 ENTER_V8(i_isolate);
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after
7665 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7661 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7666 Address callback_address = 7662 Address callback_address =
7667 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7663 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7668 VMState<EXTERNAL> state(isolate); 7664 VMState<EXTERNAL> state(isolate);
7669 ExternalCallbackScope call_scope(isolate, callback_address); 7665 ExternalCallbackScope call_scope(isolate, callback_address);
7670 callback(info); 7666 callback(info);
7671 } 7667 }
7672 7668
7673 7669
7674 } } // namespace v8::internal 7670 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698