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

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

Issue 2781443002: [Bindings] Specialize WindowDocument symbol in V8PrivateProperty (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/V8PrivateProperty.h" 5 #include "bindings/core/v8/V8PrivateProperty.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "bindings/core/v8/V8Binding.h" 9 #include "bindings/core/v8/V8Binding.h"
10 #include "bindings/core/v8/V8BindingMacros.h" 10 #include "bindings/core/v8/V8BindingMacros.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 v8::Local<v8::Value> V8PrivateProperty::Symbol::getFromMainWorld( 14 v8::Local<v8::Value> V8PrivateProperty::Symbol::getFromMainWorld(
15 ScriptWrappable* scriptWrappable) { 15 ScriptWrappable* scriptWrappable) {
16 v8::Local<v8::Object> wrapper = scriptWrappable->mainWorldWrapper(m_isolate); 16 v8::Local<v8::Object> wrapper = scriptWrappable->mainWorldWrapper(m_isolate);
17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : getOrEmpty(wrapper); 17 return wrapper.IsEmpty() ? v8::Local<v8::Value>() : getOrEmpty(wrapper);
18 } 18 }
19 19
20 v8::Local<v8::Private> V8PrivateProperty::createV8Private(v8::Isolate* isolate, 20 v8::Local<v8::Private> V8PrivateProperty::createV8Private(v8::Isolate* isolate,
21 const char* symbol, 21 const char* symbol) {
22 size_t length) { 22 return v8::Private::New(isolate, v8String(isolate, symbol));
23 v8::Local<v8::String> str = 23 }
24 v8::String::NewFromOneByte( 24
25 isolate, reinterpret_cast<const uint8_t*>(symbol), 25 v8::Local<v8::Private> V8PrivateProperty::createCachedV8Private(
26 v8::NewStringType::kNormal, static_cast<int>(length)) 26 v8::Isolate* isolate,
27 .ToLocalChecked(); 27 const char* symbol) {
28 return v8::Private::New(isolate, str); 28 // Use ForApi() to get the same Private symbol which is not cached in Chrome.
29 return v8::Private::ForApi(isolate, v8String(isolate, symbol));
29 } 30 }
30 31
31 } // namespace blink 32 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698