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

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

Issue 18778002: Inherit EventTarget interface instead of duplicating its code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 5 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/V8WindowShell.cpp ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::info; 117 WrapperTypeInfo* contextType = &V8DedicatedWorkerGlobalScope::info;
118 if (!m_workerGlobalScope->isDedicatedWorkerGlobalScope()) 118 if (!m_workerGlobalScope->isDedicatedWorkerGlobalScope())
119 contextType = &V8SharedWorkerGlobalScope::info; 119 contextType = &V8SharedWorkerGlobalScope::info;
120 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co nstructorForType(contextType); 120 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co nstructorForType(contextType);
121 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance (workerGlobalScopeConstructor); 121 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance (workerGlobalScopeConstructor);
122 if (jsWorkerGlobalScope.IsEmpty()) { 122 if (jsWorkerGlobalScope.IsEmpty()) {
123 disposeContext(); 123 disposeContext();
124 return false; 124 return false;
125 } 125 }
126 126
127 V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerGlobalScope>(m_wor kerGlobalScope), contextType, jsWorkerGlobalScope, m_isolate, WrapperConfigurati on::Dependent); 127 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, m_isolat e, WrapperConfiguration::Dependent);
128 128
129 // Insert the object instance as the prototype of the shadow object. 129 // Insert the object instance as the prototype of the shadow object.
130 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context .newLocal(m_isolate)->Global()->GetPrototype()); 130 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context .newLocal(m_isolate)->Global()->GetPrototype());
131 globalObject->SetPrototype(jsWorkerGlobalScope); 131 globalObject->SetPrototype(jsWorkerGlobalScope);
132 132
133 return true; 133 return true;
134 } 134 }
135 135
136 ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt ate* state) 136 ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt ate* state)
137 { 137 {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 v8::Handle<v8::Object> global = context->Global(); 248 v8::Handle<v8::Object> global = context->Global();
249 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld)); 249 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld));
250 // Return 0 if the current executing context is not the worker context. 250 // Return 0 if the current executing context is not the worker context.
251 if (global.IsEmpty()) 251 if (global.IsEmpty())
252 return 0; 252 return 0;
253 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ; 253 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ;
254 return workerGlobalScope->script(); 254 return workerGlobalScope->script();
255 } 255 }
256 256
257 } // namespace WebCore 257 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8WindowShell.cpp ('k') | Source/bindings/v8/custom/V8ArrayBufferCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698