Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: Source/bindings/core/v8/V8MutationCallback.cpp

Issue 622333002: Flip the true/false result of ScriptState::contextIsValid (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 m_callback.setWeak(this, &setWeakCallback); 45 m_callback.setWeak(this, &setWeakCallback);
46 } 46 }
47 47
48 void V8MutationCallback::call(const WillBeHeapVector<RefPtrWillBeMember<Mutation Record> >& mutations, MutationObserver* observer) 48 void V8MutationCallback::call(const WillBeHeapVector<RefPtrWillBeMember<Mutation Record> >& mutations, MutationObserver* observer)
49 { 49 {
50 if (!canInvokeCallback()) 50 if (!canInvokeCallback())
51 return; 51 return;
52 52
53 v8::Isolate* isolate = m_scriptState->isolate(); 53 v8::Isolate* isolate = m_scriptState->isolate();
54 54
55 if (m_scriptState->contextIsValid()) 55 if (!m_scriptState->contextIsValid())
56 return; 56 return;
57 ScriptState::Scope scope(m_scriptState.get()); 57 ScriptState::Scope scope(m_scriptState.get());
58 58
59 if (m_callback.isEmpty()) 59 if (m_callback.isEmpty())
60 return; 60 return;
61 v8::Handle<v8::Value> observerHandle = toV8(observer, m_scriptState->context ()->Global(), isolate); 61 v8::Handle<v8::Value> observerHandle = toV8(observer, m_scriptState->context ()->Global(), isolate);
62 if (observerHandle.IsEmpty()) { 62 if (observerHandle.IsEmpty()) {
63 if (!isScriptControllerTerminating()) 63 if (!isScriptControllerTerminating())
64 CRASH(); 64 CRASH();
65 return; 65 return;
66 } 66 }
67 67
68 if (!observerHandle->IsObject()) 68 if (!observerHandle->IsObject())
69 return; 69 return;
70 70
71 v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHan dle); 71 v8::Handle<v8::Object> thisObject = v8::Handle<v8::Object>::Cast(observerHan dle);
72 v8::Handle<v8::Value> argv[] = { v8Array(mutations, m_scriptState->context() ->Global(), isolate), observerHandle }; 72 v8::Handle<v8::Value> argv[] = { v8Array(mutations, m_scriptState->context() ->Global(), isolate), observerHandle };
73 73
74 v8::TryCatch exceptionCatcher; 74 v8::TryCatch exceptionCatcher;
75 exceptionCatcher.SetVerbose(true); 75 exceptionCatcher.SetVerbose(true);
76 ScriptController::callFunction(executionContext(), m_callback.newLocal(isola te), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate); 76 ScriptController::callFunction(executionContext(), m_callback.newLocal(isola te), thisObject, WTF_ARRAY_LENGTH(argv), argv, isolate);
77 } 77 }
78 78
79 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackData<v8::Function , V8MutationCallback>& data) 79 void V8MutationCallback::setWeakCallback(const v8::WeakCallbackData<v8::Function , V8MutationCallback>& data)
80 { 80 {
81 data.GetParameter()->m_callback.clear(); 81 data.GetParameter()->m_callback.clear();
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8EventListenerList.cpp ('k') | Source/bindings/core/v8/V8WorkerGlobalScopeEventListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698