| OLD | NEW |
| 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/modules/v8/V8IDBObserverCallback.h" | 5 #include "bindings/modules/v8/V8IDBObserverCallback.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptController.h" | 7 #include "bindings/core/v8/ScriptController.h" |
| 8 #include "bindings/core/v8/ToV8.h" | 8 #include "bindings/core/v8/ToV8.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8PrivateProperty.h" | 10 #include "bindings/core/v8/V8PrivateProperty.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 if (!canInvokeCallback()) | 32 if (!canInvokeCallback()) |
| 33 return; | 33 return; |
| 34 | 34 |
| 35 if (!m_scriptState->contextIsValid()) | 35 if (!m_scriptState->contextIsValid()) |
| 36 return; | 36 return; |
| 37 ScriptState::Scope scope(m_scriptState.get()); | 37 ScriptState::Scope scope(m_scriptState.get()); |
| 38 | 38 |
| 39 if (m_callback.isEmpty()) | 39 if (m_callback.isEmpty()) |
| 40 return; | 40 return; |
| 41 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context
()->Global(), m_scriptState->isolate()); | 41 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context
()->Global(), m_scriptState->isolate()); |
| 42 if (observerHandle.IsEmpty()) { | |
| 43 if (!isScriptControllerTerminating()) | |
| 44 CRASH(); | |
| 45 return; | |
| 46 } | |
| 47 | |
| 48 if (!observerHandle->IsObject()) | 42 if (!observerHandle->IsObject()) |
| 49 return; | 43 return; |
| 50 | 44 |
| 51 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); | 45 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); |
| 52 v8::Local<v8::Value> changesHandle = toV8(&changes, m_scriptState->context()
->Global(), m_scriptState->isolate()); | 46 v8::Local<v8::Value> changesHandle = toV8(&changes, m_scriptState->context()
->Global(), m_scriptState->isolate()); |
| 53 if (changesHandle.IsEmpty()) | 47 if (changesHandle.IsEmpty()) |
| 54 return; | 48 return; |
| 55 | 49 |
| 56 v8::Local<v8::Value> argv[] = { changesHandle }; | 50 v8::Local<v8::Value> argv[] = { changesHandle }; |
| 57 | 51 |
| 58 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()),
m_scriptState->getExecutionContext(), thisObject, WTF_ARRAY_LENGTH(argv), argv,
m_scriptState->isolate()); | 52 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()),
m_scriptState->getExecutionContext(), thisObject, WTF_ARRAY_LENGTH(argv), argv,
m_scriptState->isolate()); |
| 59 } | 53 } |
| 60 | 54 |
| 61 DEFINE_TRACE(V8IDBObserverCallback) | 55 DEFINE_TRACE(V8IDBObserverCallback) |
| 62 { | 56 { |
| 63 IDBObserverCallback::trace(visitor); | 57 IDBObserverCallback::trace(visitor); |
| 64 ActiveDOMCallback::trace(visitor); | 58 ActiveDOMCallback::trace(visitor); |
| 65 } | 59 } |
| 66 | 60 |
| 67 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |