| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "bindings/core/v8/V8Binding.h" | 29 #include "bindings/core/v8/V8Binding.h" |
| 30 #include "bindings/core/v8/V8HiddenValue.h" | 30 #include "bindings/core/v8/V8HiddenValue.h" |
| 31 #include "bindings/core/v8/V8MutationObserver.h" | 31 #include "bindings/core/v8/V8MutationObserver.h" |
| 32 #include "bindings/core/v8/V8MutationRecord.h" | 32 #include "bindings/core/v8/V8MutationRecord.h" |
| 33 #include "core/dom/ExecutionContext.h" | 33 #include "core/dom/ExecutionContext.h" |
| 34 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 V8MutationCallback::V8MutationCallback(v8::Local<v8::Function> callback, v8::Loc
al<v8::Object> owner, ScriptState* scriptState) | 38 V8MutationCallback::V8MutationCallback(v8::Local<v8::Function> callback, v8::Loc
al<v8::Object> owner, ScriptState* scriptState) |
| 39 : ActiveDOMCallback(scriptState->executionContext()) | 39 : ActiveDOMCallback(scriptState->getExecutionContext()) |
| 40 , m_callback(scriptState->isolate(), callback) | 40 , m_callback(scriptState->isolate(), callback) |
| 41 , m_scriptState(scriptState) | 41 , m_scriptState(scriptState) |
| 42 { | 42 { |
| 43 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc
riptState->isolate()), callback); | 43 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc
riptState->isolate()), callback); |
| 44 m_callback.setWeak(this, &setWeakCallback); | 44 m_callback.setWeak(this, &setWeakCallback); |
| 45 } | 45 } |
| 46 | 46 |
| 47 V8MutationCallback::~V8MutationCallback() | 47 V8MutationCallback::~V8MutationCallback() |
| 48 { | 48 { |
| 49 } | 49 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 72 return; | 72 return; |
| 73 | 73 |
| 74 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); | 74 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); |
| 75 v8::Local<v8::Value> v8Mutations = toV8(mutations, m_scriptState->context()-
>Global(), isolate); | 75 v8::Local<v8::Value> v8Mutations = toV8(mutations, m_scriptState->context()-
>Global(), isolate); |
| 76 if (v8Mutations.IsEmpty()) | 76 if (v8Mutations.IsEmpty()) |
| 77 return; | 77 return; |
| 78 v8::Local<v8::Value> argv[] = { v8Mutations, observerHandle }; | 78 v8::Local<v8::Value> argv[] = { v8Mutations, observerHandle }; |
| 79 | 79 |
| 80 v8::TryCatch exceptionCatcher(isolate); | 80 v8::TryCatch exceptionCatcher(isolate); |
| 81 exceptionCatcher.SetVerbose(true); | 81 exceptionCatcher.SetVerbose(true); |
| 82 ScriptController::callFunction(executionContext(), m_callback.newLocal(isola
te), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate); | 82 ScriptController::callFunction(getExecutionContext(), m_callback.newLocal(is
olate), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackInfo<V8MutationCa
llback>& data) | 85 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackInfo<V8MutationCa
llback>& data) |
| 86 { | 86 { |
| 87 data.GetParameter()->m_callback.clear(); | 87 data.GetParameter()->m_callback.clear(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 DEFINE_TRACE(V8MutationCallback) | 90 DEFINE_TRACE(V8MutationCallback) |
| 91 { | 91 { |
| 92 MutationCallback::trace(visitor); | 92 MutationCallback::trace(visitor); |
| 93 ActiveDOMCallback::trace(visitor); | 93 ActiveDOMCallback::trace(visitor); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |