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

Side by Side Diff: Source/bindings/v8/ScriptEventListener.cpp

Issue 23450039: Pass isolate to ScriptValue constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.cpp ('k') | Source/bindings/v8/ScriptFunctionCall.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return ""; 103 return "";
104 104
105 return toWebCoreStringWithNullCheck(function); 105 return toWebCoreStringWithNullCheck(function);
106 } 106 }
107 107
108 ScriptValue eventListenerHandler(Document* document, EventListener* listener) 108 ScriptValue eventListenerHandler(Document* document, EventListener* listener)
109 { 109 {
110 if (listener->type() != EventListener::JSEventListenerType) 110 if (listener->type() != EventListener::JSEventListenerType)
111 return ScriptValue(); 111 return ScriptValue();
112 112
113 v8::HandleScope scope(toIsolate(document)); 113 v8::Isolate* isolate = toIsolate(document);
114 v8::HandleScope scope(isolate);
114 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener); 115 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener);
115 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ; 116 v8::Handle<v8::Context> context = toV8Context(document, v8Listener->world()) ;
116 v8::Context::Scope contextScope(context); 117 v8::Context::Scope contextScope(context);
117 v8::Handle<v8::Object> function = v8Listener->getListenerObject(document); 118 v8::Handle<v8::Object> function = v8Listener->getListenerObject(document);
118 if (function.IsEmpty()) 119 if (function.IsEmpty())
119 return ScriptValue(); 120 return ScriptValue();
120 return ScriptValue(function); 121 return ScriptValue(function, isolate);
121 } 122 }
122 123
123 ScriptState* eventListenerHandlerScriptState(Frame* frame, EventListener* listen er) 124 ScriptState* eventListenerHandlerScriptState(Frame* frame, EventListener* listen er)
124 { 125 {
125 if (listener->type() != EventListener::JSEventListenerType) 126 if (listener->type() != EventListener::JSEventListenerType)
126 return 0; 127 return 0;
127 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener); 128 V8AbstractEventListener* v8Listener = static_cast<V8AbstractEventListener*>( listener);
128 v8::HandleScope scope(toIsolate(frame)); 129 v8::HandleScope scope(toIsolate(frame));
129 v8::Handle<v8::Context> v8Context = frame->script()->windowShell(v8Listener- >world())->context(); 130 v8::Handle<v8::Context> v8Context = frame->script()->windowShell(v8Listener- >world())->context();
130 return ScriptState::forContext(v8Context); 131 return ScriptState::forContext(v8Context);
(...skipping 18 matching lines...) Expand all
149 v8::ScriptOrigin origin = function->GetScriptOrigin(); 150 v8::ScriptOrigin origin = function->GetScriptOrigin();
150 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString()) 151 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString())
151 sourceName = toWebCoreString(origin.ResourceName().As<v8::String>()); 152 sourceName = toWebCoreString(origin.ResourceName().As<v8::String>());
152 else 153 else
153 sourceName = ""; 154 sourceName = "";
154 lineNumber = function->GetScriptLineNumber(); 155 lineNumber = function->GetScriptLineNumber();
155 return true; 156 return true;
156 } 157 }
157 158
158 } // namespace WebCore 159 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.cpp ('k') | Source/bindings/v8/ScriptFunctionCall.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698