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

Unified Diff: src/api.cc

Issue 1152523002: Remove v8::Private (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 125a31be06f94b802e9f61a465335ee641b8c189..255f762e293d6a50408cea5a9e9dd7b95ce5f505 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3460,12 +3460,6 @@ bool v8::Object::ForceSet(v8::Handle<Value> key, v8::Handle<Value> value,
}
-bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) {
- return ForceSet(v8::Handle<Value>(reinterpret_cast<Value*>(*key)),
- value, DontEnum);
-}
-
-
namespace {
i::MaybeHandle<i::Object> DeleteObjectProperty(
@@ -3544,11 +3538,6 @@ Local<Value> v8::Object::Get(uint32_t index) {
}
-Local<Value> v8::Object::GetPrivate(v8::Handle<Private> key) {
- return Get(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
-}
-
-
Maybe<PropertyAttribute> v8::Object::GetPropertyAttributes(
Local<Context> context, Local<Value> key) {
PREPARE_FOR_EXECUTION_PRIMITIVE(
@@ -3780,11 +3769,6 @@ bool v8::Object::Delete(v8::Handle<Value> key) {
}
-bool v8::Object::DeletePrivate(v8::Handle<Private> key) {
- return Delete(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
-}
-
-
Maybe<bool> v8::Object::Has(Local<Context> context, Local<Value> key) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Get()", bool);
auto self = Utils::OpenHandle(this);
@@ -3813,13 +3797,6 @@ bool v8::Object::Has(v8::Handle<Value> key) {
}
-bool v8::Object::HasPrivate(v8::Handle<Private> key) {
- // TODO(rossberg): this should use HasOwnProperty, but we'd need to
- // generalise that to a (noy yet existant) Name argument first.
- return Has(v8::Handle<Value>(reinterpret_cast<Value*>(*key)));
-}
-
-
Maybe<bool> v8::Object::Delete(Local<Context> context, uint32_t index) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DeleteProperty()",
bool);
@@ -5175,11 +5152,6 @@ Local<Value> Symbol::Name() const {
}
-Local<Value> Private::Name() const {
- return reinterpret_cast<const Symbol*>(this)->Name();
-}
-
-
double Number::Value() const {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return obj->Number();
@@ -6485,38 +6457,6 @@ Local<Symbol> v8::Symbol::GetToStringTag(Isolate* isolate) {
}
-Local<Private> v8::Private::New(Isolate* isolate, Local<String> name) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- LOG_API(i_isolate, "Private::New()");
- ENTER_V8(i_isolate);
- i::Handle<i::Symbol> symbol = i_isolate->factory()->NewPrivateSymbol();
- if (!name.IsEmpty()) symbol->set_name(*Utils::OpenHandle(*name));
- Local<Symbol> result = Utils::ToLocal(symbol);
- return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
-}
-
-
-Local<Private> v8::Private::ForApi(Isolate* isolate, Local<String> name) {
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- i::Handle<i::String> i_name = Utils::OpenHandle(*name);
- i::Handle<i::JSObject> registry = i_isolate->GetSymbolRegistry();
- i::Handle<i::String> part = i_isolate->factory()->private_api_string();
- i::Handle<i::JSObject> privates =
- i::Handle<i::JSObject>::cast(
- i::Object::GetPropertyOrElement(registry, part).ToHandleChecked());
- i::Handle<i::Object> symbol =
- i::Object::GetPropertyOrElement(privates, i_name).ToHandleChecked();
- if (!symbol->IsSymbol()) {
- DCHECK(symbol->IsUndefined());
- symbol = i_isolate->factory()->NewPrivateSymbol();
- i::Handle<i::Symbol>::cast(symbol)->set_name(*i_name);
- i::JSObject::SetProperty(privates, i_name, symbol, i::STRICT).Assert();
- }
- Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol));
- return v8::Handle<Private>(reinterpret_cast<Private*>(*result));
-}
-
-
Local<Number> v8::Number::New(Isolate* isolate, double value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (std::isnan(value)) {
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698