| 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 26 matching lines...) Expand all Loading... |
| 37 exceptionState.throwTypeError("parameter 2 ('options') is not an object."); | 37 exceptionState.throwTypeError("parameter 2 ('options') is not an object."); |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 if (exceptionState.hadException()) | 41 if (exceptionState.hadException()) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 44 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
| 45 v8::Local<v8::Function> v8Callback = v8::Local<v8::Function>::Cast(info[0]); | 45 v8::Local<v8::Function> v8Callback = v8::Local<v8::Function>::Cast(info[0]); |
| 46 IDBObserverCallback* callback = | 46 IDBObserverCallback* callback = |
| 47 IDBObserverCallback::create(scriptState, v8Callback); | 47 // DO NOT SUBMIT - merge marker - please spell |Create| below. |
| 48 IDBObserverCallback::Create(scriptState, v8Callback); |
| 48 IDBObserver* observer = IDBObserver::create(callback); | 49 IDBObserver* observer = IDBObserver::create(callback); |
| 49 if (exceptionState.hadException()) | 50 if (exceptionState.hadException()) |
| 50 return; | 51 return; |
| 51 DCHECK(observer); | 52 DCHECK(observer); |
| 52 // TODO(bashi): Don't set private property (and remove this custom | 53 // TODO(bashi): Don't set private property (and remove this custom |
| 53 // constructor) when we can trace correctly. | 54 // constructor) when we can trace correctly. |
| 54 V8PrivateProperty::getIDBObserverCallback(info.GetIsolate()) | 55 V8PrivateProperty::getIDBObserverCallback(info.GetIsolate()) |
| 55 .set(info.GetIsolate()->GetCurrentContext(), wrapper, v8Callback); | 56 .set(info.GetIsolate()->GetCurrentContext(), wrapper, v8Callback); |
| 56 v8SetReturnValue(info, | 57 v8SetReturnValue(info, |
| 57 V8DOMWrapper::associateObjectWithWrapper( | 58 V8DOMWrapper::associateObjectWithWrapper( |
| 58 info.GetIsolate(), observer, &wrapperTypeInfo, wrapper)); | 59 info.GetIsolate(), observer, &wrapperTypeInfo, wrapper)); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |