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

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

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: 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/ScriptState.h" 5 #include "bindings/core/v8/ScriptState.h"
6 6
7 #include "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 23 matching lines...) Expand all
34 : isolate_(context->GetIsolate()), 34 : isolate_(context->GetIsolate()),
35 context_(isolate_, context), 35 context_(isolate_, context),
36 world_(std::move(world)), 36 world_(std::move(world)),
37 per_context_data_(V8PerContextData::Create(context)) { 37 per_context_data_(V8PerContextData::Create(context)) {
38 DCHECK(world_); 38 DCHECK(world_);
39 context_.SetWeak(this, &ContextCollectedCallback); 39 context_.SetWeak(this, &ContextCollectedCallback);
40 context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this); 40 context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this);
41 } 41 }
42 42
43 ScriptState::~ScriptState() { 43 ScriptState::~ScriptState() {
44 ASSERT(!per_context_data_); 44 DCHECK(!per_context_data_);
45 ASSERT(context_.IsEmpty()); 45 DCHECK(context_.IsEmpty());
46 } 46 }
47 47
48 void ScriptState::DetachGlobalObject() { 48 void ScriptState::DetachGlobalObject() {
49 ASSERT(!context_.IsEmpty()); 49 DCHECK(!context_.IsEmpty());
50 GetContext()->DetachGlobal(); 50 GetContext()->DetachGlobal();
51 } 51 }
52 52
53 void ScriptState::DisposePerContextData() { 53 void ScriptState::DisposePerContextData() {
54 per_context_data_ = nullptr; 54 per_context_data_ = nullptr;
55 } 55 }
56 56
57 ScriptValue ScriptState::GetFromExtrasExports(const char* name) { 57 ScriptValue ScriptState::GetFromExtrasExports(const char* name) {
58 v8::HandleScope handle_scope(isolate_); 58 v8::HandleScope handle_scope(isolate_);
59 v8::Local<v8::Value> v8_value; 59 v8::Local<v8::Value> v8_value;
60 if (!GetContext() 60 if (!GetContext()
61 ->GetExtrasBindingObject() 61 ->GetExtrasBindingObject()
62 ->Get(GetContext(), V8AtomicString(GetIsolate(), name)) 62 ->Get(GetContext(), V8AtomicString(GetIsolate(), name))
63 .ToLocal(&v8_value)) 63 .ToLocal(&v8_value))
64 return ScriptValue(); 64 return ScriptValue();
65 return ScriptValue(this, v8_value); 65 return ScriptValue(this, v8_value);
66 } 66 }
67 67
68 ExecutionContext* ScriptState::GetExecutionContext() const { 68 ExecutionContext* ScriptState::GetExecutionContext() const {
69 v8::HandleScope scope(isolate_); 69 v8::HandleScope scope(isolate_);
70 return ToExecutionContext(GetContext()); 70 return ToExecutionContext(GetContext());
71 } 71 }
72 72
73 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698