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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp

Issue 2007463003: binding: Reimplements V8HiddenValue as V8PrivateProperty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 4 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
Index: third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2e4f419d3a0409d08e429f32c1fc39ea748dc810
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp
@@ -0,0 +1,26 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "bindings/core/v8/V8PrivateProperty.h"
+
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8BindingMacros.h"
+
+namespace blink {
+
+v8::Local<v8::Value> V8PrivateProperty::Symbol::getFromMainWorld(ScriptState* scriptState, ScriptWrappable* scriptWrappable)
+{
+ v8::Local<v8::Object> wrapper = scriptWrappable->newLocalWrapper(scriptState->isolate());
+ return wrapper.IsEmpty() ? v8::Local<v8::Value>() : get(scriptState->context(), wrapper);
+}
+
+v8::Local<v8::Private> V8PrivateProperty::createV8Private(v8::Isolate* isolate, const char* symbol, size_t length)
+{
+ v8::Local<v8::String> str = v8CallOrCrash(v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_t*>(symbol), v8::NewStringType::kNormal, static_cast<int>(length)));
+ return v8::Private::ForApi(isolate, str);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698