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

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

Issue 178663004: Oilpan: move WorkerGlobalScope to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | Source/core/workers/WorkerGlobalScope.h » ('J')
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo; 154 contextType = &V8ServiceWorkerGlobalScope::wrapperTypeInfo;
155 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope()) 155 else if (!m_workerGlobalScope.isDedicatedWorkerGlobalScope())
156 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo; 156 contextType = &V8SharedWorkerGlobalScope::wrapperTypeInfo;
157 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co nstructorForType(contextType); 157 v8::Handle<v8::Function> workerGlobalScopeConstructor = m_perContextData->co nstructorForType(contextType);
158 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance (workerGlobalScopeConstructor); 158 v8::Local<v8::Object> jsWorkerGlobalScope = V8ObjectConstructor::newInstance (workerGlobalScopeConstructor);
159 if (jsWorkerGlobalScope.IsEmpty()) { 159 if (jsWorkerGlobalScope.IsEmpty()) {
160 disposeContext(); 160 disposeContext();
161 return false; 161 return false;
162 } 162 }
163 163
164 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtr<Wor kerGlobalScope>(m_workerGlobalScope), contextType, jsWorkerGlobalScope, isolate( ), WrapperConfiguration::Dependent); 164 V8DOMWrapper::associateObjectWithWrapper<V8WorkerGlobalScope>(PassRefPtrWill BeRawPtr<WorkerGlobalScope>(&m_workerGlobalScope), contextType, jsWorkerGlobalSc ope, isolate(), WrapperConfiguration::Dependent);
haraken 2014/02/25 01:30:49 I'm surprised that we didn't need '&' before :)
Mads Ager (chromium) 2014/02/25 07:34:18 PassRefPtr has a constructor that takes a const re
haraken 2014/02/25 07:43:03 I don't know, but I agree with Mads that using exp
165 165
166 // Insert the object instance as the prototype of the shadow object. 166 // Insert the object instance as the prototype of the shadow object.
167 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context Holder->context()->Global()->GetPrototype()); 167 v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context Holder->context()->Global()->GetPrototype());
168 globalObject->SetPrototype(jsWorkerGlobalScope); 168 globalObject->SetPrototype(jsWorkerGlobalScope);
169 169
170 return true; 170 return true;
171 } 171 }
172 172
173 ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt ate* state) 173 ScriptValue WorkerScriptController::evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionSt ate* state)
174 { 174 {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 v8::Handle<v8::Object> global = context->Global(); 287 v8::Handle<v8::Object> global = context->Global();
288 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::domTempla te(isolate, WorkerWorld)); 288 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::domTempla te(isolate, WorkerWorld));
289 // Return 0 if the current executing context is not the worker context. 289 // Return 0 if the current executing context is not the worker context.
290 if (global.IsEmpty()) 290 if (global.IsEmpty())
291 return 0; 291 return 0;
292 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ; 292 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ;
293 return workerGlobalScope->script(); 293 return workerGlobalScope->script();
294 } 294 }
295 295
296 } // namespace WebCore 296 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | Source/core/workers/WorkerGlobalScope.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698