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

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

Issue 2021203002: Rename ScriptWrappable::newLocalWrapper to ScriptWrappable::mainWorldWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ScriptWrappable.h" 5 #include "bindings/core/v8/ScriptWrappable.h"
6 6
7 #include "bindings/core/v8/DOMDataStore.h" 7 #include "bindings/core/v8/DOMDataStore.h"
8 #include "bindings/core/v8/ScriptWrappableVisitor.h" 8 #include "bindings/core/v8/ScriptWrappableVisitor.h"
9 #include "bindings/core/v8/V8DOMWrapper.h" 9 #include "bindings/core/v8/V8DOMWrapper.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 struct SameSizeAsScriptWrappable { 13 struct SameSizeAsScriptWrappable {
14 virtual ~SameSizeAsScriptWrappable() { } 14 virtual ~SameSizeAsScriptWrappable() { }
15 v8::Persistent<v8::Object> m_wrapper; 15 v8::Persistent<v8::Object> m_mainWorldWrapper;
16 }; 16 };
17 17
18 static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), "Scr iptWrappable should stay small"); 18 static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), "Scr iptWrappable should stay small");
19 19
20 v8::Local<v8::Object> ScriptWrappable::wrap(v8::Isolate* isolate, v8::Local<v8:: Object> creationContext) 20 v8::Local<v8::Object> ScriptWrappable::wrap(v8::Isolate* isolate, v8::Local<v8:: Object> creationContext)
21 { 21 {
22 const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo(); 22 const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
23 23
24 ASSERT(!DOMDataStore::containsWrapper(this, isolate)); 24 ASSERT(!DOMDataStore::containsWrapper(this, isolate));
25 25
26 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperTypeInfo); 26 v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creatio nContext, wrapperTypeInfo);
27 if (UNLIKELY(wrapper.IsEmpty())) 27 if (UNLIKELY(wrapper.IsEmpty()))
28 return wrapper; 28 return wrapper;
29 29
30 wrapperTypeInfo->installConditionallyEnabledProperties(wrapper, isolate); 30 wrapperTypeInfo->installConditionallyEnabledProperties(wrapper, isolate);
31 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper); 31 return associateWithWrapper(isolate, wrapperTypeInfo, wrapper);
32 } 32 }
33 33
34 v8::Local<v8::Object> ScriptWrappable::associateWithWrapper(v8::Isolate* isolate , const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper) 34 v8::Local<v8::Object> ScriptWrappable::associateWithWrapper(v8::Isolate* isolate , const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper)
35 { 35 {
36 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeIn fo, wrapper); 36 return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeIn fo, wrapper);
37 } 37 }
38 38
39 void ScriptWrappable::markWrapper(v8::Isolate* isolate) const 39 void ScriptWrappable::markWrapper(v8::Isolate* isolate) const
40 { 40 {
41 if (containsWrapper()) 41 if (containsWrapper())
42 ScriptWrappableVisitor::markWrapper(&m_wrapper, isolate); 42 ScriptWrappableVisitor::markWrapper(&m_mainWorldWrapper, isolate);
43 } 43 }
44 44
45 } // namespace blink 45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698