| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 template<> | 38 template<> |
| 39 void WeakHandleListener<V8MutationCallback>::callback(v8::Isolate*, v8::Persiste
nt<v8::Value>, V8MutationCallback* callback) | 39 void WeakHandleListener<V8MutationCallback>::callback(v8::Isolate*, v8::Persiste
nt<v8::Value>, V8MutationCallback* callback) |
| 40 { | 40 { |
| 41 callback->m_callback.clear(); | 41 callback->m_callback.clear(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 V8MutationCallback::V8MutationCallback(v8::Handle<v8::Function> callback, Script
ExecutionContext* context, v8::Handle<v8::Object> owner, v8::Isolate* isolate) | 44 V8MutationCallback::V8MutationCallback(v8::Handle<v8::Function> callback, Script
ExecutionContext* context, v8::Handle<v8::Object> owner, v8::Isolate* isolate) |
| 45 : ActiveDOMCallback(context) | 45 : ActiveDOMCallback(context) |
| 46 , m_callback(callback) | 46 , m_callback(callback) |
| 47 , m_world(DOMWrapperWorld::current(context)) | 47 , m_world(DOMWrapperWorld::current()) |
| 48 { | 48 { |
| 49 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); | 49 owner->SetHiddenValue(V8HiddenPropertyName::callback(), callback); |
| 50 WeakHandleListener<V8MutationCallback>::makeWeak(isolate, m_callback.get(),
this); | 50 WeakHandleListener<V8MutationCallback>::makeWeak(isolate, m_callback.get(),
this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void V8MutationCallback::call(const Vector<RefPtr<MutationRecord> >& mutations,
MutationObserver* observer) | 53 void V8MutationCallback::call(const Vector<RefPtr<MutationRecord> >& mutations,
MutationObserver* observer) |
| 54 { | 54 { |
| 55 if (!canInvokeCallback()) | 55 if (!canInvokeCallback()) |
| 56 return; | 56 return; |
| 57 | 57 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHan
dle); | 79 v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHan
dle); |
| 80 v8::Handle<v8::Value> argv[] = { v8Array(mutations, isolate), observerHandle
}; | 80 v8::Handle<v8::Value> argv[] = { v8Array(mutations, isolate), observerHandle
}; |
| 81 | 81 |
| 82 v8::TryCatch exceptionCatcher; | 82 v8::TryCatch exceptionCatcher; |
| 83 exceptionCatcher.SetVerbose(true); | 83 exceptionCatcher.SetVerbose(true); |
| 84 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, thisObject, 2, argv); | 84 ScriptController::callFunctionWithInstrumentation(scriptExecutionContext(),
callback, thisObject, 2, argv); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace WebCore | 87 } // namespace WebCore |
| OLD | NEW |