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

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

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error 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
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> main_world_wrapper_; 15 v8::Persistent<v8::Object> main_world_wrapper_;
16 }; 16 };
17 17
18 static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable), 18 static_assert(sizeof(ScriptWrappable) <= sizeof(SameSizeAsScriptWrappable),
19 "ScriptWrappable should stay small"); 19 "ScriptWrappable should stay small");
20 20
21 v8::Local<v8::Object> ScriptWrappable::Wrap( 21 v8::Local<v8::Object> ScriptWrappable::Wrap(
22 v8::Isolate* isolate, 22 v8::Isolate* isolate,
23 v8::Local<v8::Object> creation_context) { 23 v8::Local<v8::Object> creation_context) {
24 const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo(); 24 const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo();
25 25
26 ASSERT(!DOMDataStore::ContainsWrapper(this, isolate)); 26 DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));
27 27
28 v8::Local<v8::Object> wrapper = 28 v8::Local<v8::Object> wrapper =
29 V8DOMWrapper::CreateWrapper(isolate, creation_context, wrapper_type_info); 29 V8DOMWrapper::CreateWrapper(isolate, creation_context, wrapper_type_info);
30 DCHECK(!wrapper.IsEmpty()); 30 DCHECK(!wrapper.IsEmpty());
31 return AssociateWithWrapper(isolate, wrapper_type_info, wrapper); 31 return AssociateWithWrapper(isolate, wrapper_type_info, wrapper);
32 } 32 }
33 33
34 v8::Local<v8::Object> ScriptWrappable::AssociateWithWrapper( 34 v8::Local<v8::Object> ScriptWrappable::AssociateWithWrapper(
35 v8::Isolate* isolate, 35 v8::Isolate* isolate,
36 const WrapperTypeInfo* wrapper_type_info, 36 const WrapperTypeInfo* wrapper_type_info,
37 v8::Local<v8::Object> wrapper) { 37 v8::Local<v8::Object> wrapper) {
38 return V8DOMWrapper::AssociateObjectWithWrapper(isolate, this, 38 return V8DOMWrapper::AssociateObjectWithWrapper(isolate, this,
39 wrapper_type_info, wrapper); 39 wrapper_type_info, wrapper);
40 } 40 }
41 41
42 void ScriptWrappable::MarkWrapper(const WrapperVisitor* visitor) const { 42 void ScriptWrappable::MarkWrapper(const WrapperVisitor* visitor) const {
43 if (ContainsWrapper()) 43 if (ContainsWrapper())
44 visitor->MarkWrapper(&main_world_wrapper_.As<v8::Value>()); 44 visitor->MarkWrapper(&main_world_wrapper_.As<v8::Value>());
45 } 45 }
46 46
47 } // namespace blink 47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698