| 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/V8IDBObserver.h" | 5 #include "bindings/modules/v8/V8IDBObserver.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionMessages.h" | 7 #include "bindings/core/v8/ExceptionMessages.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8DOMWrapper.h" | 10 #include "bindings/core/v8/V8DOMWrapper.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 exceptionState.throwTypeError("parameter 2 ('options') is not an object."); | 38 exceptionState.throwTypeError("parameter 2 ('options') is not an object."); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 | 41 |
| 42 if (exceptionState.hadException()) | 42 if (exceptionState.hadException()) |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 45 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
| 46 v8::Local<v8::Function> v8Callback = v8::Local<v8::Function>::Cast(info[0]); | 46 v8::Local<v8::Function> v8Callback = v8::Local<v8::Function>::Cast(info[0]); |
| 47 IDBObserverCallback* callback = | 47 IDBObserverCallback* callback = |
| 48 IDBObserverCallback::create(scriptState, v8Callback); | 48 IDBObserverCallback::Create(scriptState, v8Callback); |
| 49 IDBObserver* observer = IDBObserver::create(callback); | 49 IDBObserver* observer = IDBObserver::create(callback); |
| 50 if (exceptionState.hadException()) | 50 if (exceptionState.hadException()) |
| 51 return; | 51 return; |
| 52 DCHECK(observer); | 52 DCHECK(observer); |
| 53 // TODO(bashi): Don't set private property (and remove this custom | 53 // TODO(bashi): Don't set private property (and remove this custom |
| 54 // constructor) when we can trace correctly. | 54 // constructor) when we can trace correctly. |
| 55 V8PrivateProperty::getIDBObserverCallback(isolate).set(wrapper, v8Callback); | 55 V8PrivateProperty::getIDBObserverCallback(isolate).set(wrapper, v8Callback); |
| 56 v8SetReturnValue(info, V8DOMWrapper::associateObjectWithWrapper( | 56 v8SetReturnValue(info, V8DOMWrapper::associateObjectWithWrapper( |
| 57 isolate, observer, &wrapperTypeInfo, wrapper)); | 57 isolate, observer, &wrapperTypeInfo, wrapper)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |