Revision: 19741
Author: [email protected]
Date: Mon Mar 10 08:20:56 2014 UTC
Log: initialize v8::Private with v8::String
[email protected]
BUG=
Review URL: https://codereview.chromium.org/179983002
http://code.google.com/p/v8/source/detail?r=19741
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/test/cctest/test-api.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Mon Mar 10 08:18:57 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Mon Mar 10 08:20:56 2014 UTC
@@ -1915,8 +1915,8 @@
Local<Value> Name() const;
// Create a private symbol. If data is not NULL, it will be the print
name.
- static Local<Private> New(
- Isolate *isolate, const char* data = NULL, int length = -1);
+ static Local<Private> New(Isolate *isolate,
+ Local<String> name = Local<String>());
private:
Private();
=======================================
--- /branches/bleeding_edge/src/api.cc Fri Mar 7 08:43:54 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Mon Mar 10 08:20:56 2014 UTC
@@ -5949,18 +5949,13 @@
Local<Private> v8::Private::New(
- Isolate* isolate, const char* data, int length) {
+ Isolate* isolate, Local<String> name) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
EnsureInitializedForIsolate(i_isolate, "v8::Private::New()");
LOG_API(i_isolate, "Private::New()");
ENTER_V8(i_isolate);
i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol();
- if (data != NULL) {
- if (length == -1) length = i::StrLength(data);
- i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8(
- i::Vector<const char>(data, length));
- symbol->set_name(*name);
- }
+ if (!name.IsEmpty()) symbol->set_name(*Utils::OpenHandle(*name));
Local<Symbol> result = Utils::ToLocal(symbol);
return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Mon Mar 10 08:18:57
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Mar 10 08:20:56
2014 UTC
@@ -2848,7 +2848,8 @@
v8::Local<v8::Object> obj = v8::Object::New(isolate);
v8::Local<v8::Private> priv1 = v8::Private::New(isolate);
- v8::Local<v8::Private> priv2 = v8::Private::New(isolate, "my-private");
+ v8::Local<v8::Private> priv2 = v8::Private::New(isolate,
+ v8_str("my-private"));
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.