| 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 12 matching lines...) Expand all Loading... |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "bindings/v8/V8MutationCallback.h" | 27 #include "bindings/v8/V8MutationCallback.h" |
| 28 | 28 |
| 29 #include "V8MutationObserver.h" | 29 #include "V8MutationObserver.h" |
| 30 #include "V8MutationRecord.h" | 30 #include "V8MutationRecord.h" |
| 31 #include "bindings/v8/ScriptController.h" | 31 #include "bindings/v8/ScriptController.h" |
| 32 #include "bindings/v8/V8Binding.h" | 32 #include "bindings/v8/V8Binding.h" |
| 33 #include "bindings/v8/V8HiddenPropertyName.h" | |
| 34 #include "core/dom/ExecutionContext.h" | 33 #include "core/dom/ExecutionContext.h" |
| 35 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
| 36 | 35 |
| 37 namespace WebCore { | 36 namespace WebCore { |
| 38 | 37 |
| 39 V8MutationCallback::V8MutationCallback(v8::Handle<v8::Function> callback, Execut
ionContext* context, v8::Handle<v8::Object> owner, v8::Isolate* isolate) | 38 V8MutationCallback::V8MutationCallback(v8::Handle<v8::Function> callback, Execut
ionContext* context, v8::Handle<v8::Object> owner, v8::Isolate* isolate) |
| 40 : ActiveDOMCallback(context) | 39 : ActiveDOMCallback(context) |
| 41 , m_callback(isolate, callback) | 40 , m_callback(isolate, callback) |
| 42 , m_world(DOMWrapperWorld::current()) | 41 , m_world(DOMWrapperWorld::current()) |
| 43 , m_isolate(isolate) | 42 , m_isolate(isolate) |
| 44 { | 43 { |
| 45 owner->SetHiddenValue(V8HiddenPropertyName::callback(m_isolate), callback); | 44 setHiddenValue(m_isolate, owner, "callback", callback); |
| 46 m_callback.setWeak(this, &setWeakCallback); | 45 m_callback.setWeak(this, &setWeakCallback); |
| 47 } | 46 } |
| 48 | 47 |
| 49 void V8MutationCallback::call(const Vector<RefPtr<MutationRecord> >& mutations,
MutationObserver* observer) | 48 void V8MutationCallback::call(const Vector<RefPtr<MutationRecord> >& mutations,
MutationObserver* observer) |
| 50 { | 49 { |
| 51 if (!canInvokeCallback()) | 50 if (!canInvokeCallback()) |
| 52 return; | 51 return; |
| 53 | 52 |
| 54 v8::HandleScope handleScope(m_isolate); | 53 v8::HandleScope handleScope(m_isolate); |
| 55 | 54 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 exceptionCatcher.SetVerbose(true); | 79 exceptionCatcher.SetVerbose(true); |
| 81 ScriptController::callFunction(executionContext(), callback, thisObject, 2,
argv, m_isolate); | 80 ScriptController::callFunction(executionContext(), callback, thisObject, 2,
argv, m_isolate); |
| 82 } | 81 } |
| 83 | 82 |
| 84 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackData<v8::Function
, V8MutationCallback>& data) | 83 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackData<v8::Function
, V8MutationCallback>& data) |
| 85 { | 84 { |
| 86 data.GetParameter()->m_callback.clear(); | 85 data.GetParameter()->m_callback.clear(); |
| 87 } | 86 } |
| 88 | 87 |
| 89 } // namespace WebCore | 88 } // namespace WebCore |
| OLD | NEW |