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

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

Issue 297513008: Decrease call sites of ScriptState::current() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/V8Binding.h » ('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) 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 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 PassRefPtr<CustomElementLifecycleCallbacks> CustomElementConstructorBuilder::cre ateCallbacks() 155 PassRefPtr<CustomElementLifecycleCallbacks> CustomElementConstructorBuilder::cre ateCallbacks()
156 { 156 {
157 ASSERT(!m_prototype.IsEmpty()); 157 ASSERT(!m_prototype.IsEmpty());
158 158
159 RefPtr<ExecutionContext> executionContext = m_scriptState->executionContext( ); 159 RefPtr<ExecutionContext> executionContext = m_scriptState->executionContext( );
160 160
161 v8::TryCatch exceptionCatcher; 161 v8::TryCatch exceptionCatcher;
162 exceptionCatcher.SetVerbose(true); 162 exceptionCatcher.SetVerbose(true);
163 163
164 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 164 v8::Isolate* isolate = m_scriptState->isolate();
165 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac k"); 165 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac k");
166 v8::Handle<v8::Function> attached = retrieveCallback(isolate, "attachedCallb ack"); 166 v8::Handle<v8::Function> attached = retrieveCallback(isolate, "attachedCallb ack");
167 v8::Handle<v8::Function> detached = retrieveCallback(isolate, "detachedCallb ack"); 167 v8::Handle<v8::Function> detached = retrieveCallback(isolate, "detachedCallb ack");
168 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri buteChangedCallback"); 168 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri buteChangedCallback");
169 169
170 m_callbacks = V8CustomElementLifecycleCallbacks::create(executionContext.get (), m_prototype, created, attached, detached, attributeChanged); 170 m_callbacks = V8CustomElementLifecycleCallbacks::create(m_scriptState.get(), m_prototype, created, attached, detached, attributeChanged);
171 return m_callbacks.get(); 171 return m_callbacks.get();
172 } 172 }
173 173
174 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I solate* isolate, const char* name) 174 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I solate* isolate, const char* name)
175 { 175 {
176 v8::Handle<v8::Value> value = m_prototype->Get(v8String(isolate, name)); 176 v8::Handle<v8::Value> value = m_prototype->Get(v8String(isolate, name));
177 if (value.IsEmpty() || !value->IsFunction()) 177 if (value.IsEmpty() || !value->IsFunction())
178 return v8::Handle<v8::Function>(); 178 return v8::Handle<v8::Function>();
179 return value.As<v8::Function>(); 179 return value.As<v8::Function>();
180 } 180 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 #if ENABLE(OILPAN) 302 #if ENABLE(OILPAN)
303 // FIXME: Oilpan: We don't have RawPtr<Eement> version of 303 // FIXME: Oilpan: We don't have RawPtr<Eement> version of
304 // v8SetReturnValueFast until Node.idl has WillBeGarbageCollected. 304 // v8SetReturnValueFast until Node.idl has WillBeGarbageCollected.
305 v8SetReturnValueFast(info, element.get(), document); 305 v8SetReturnValueFast(info, element.get(), document);
306 #else 306 #else
307 v8SetReturnValueFast(info, element.release(), document); 307 v8SetReturnValueFast(info, element.release(), document);
308 #endif 308 #endif
309 } 309 }
310 310
311 } // namespace WebCore 311 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698