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

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

Issue 17648006: Rename WorkerContext to WorkerGlobalScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 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) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/V8Binding.h" 32 #include "bindings/v8/V8Binding.h"
33 33
34 #include "V8DOMStringList.h" 34 #include "V8DOMStringList.h"
35 #include "V8Element.h" 35 #include "V8Element.h"
36 #include "V8Window.h" 36 #include "V8Window.h"
37 #include "V8WorkerContext.h" 37 #include "V8WorkerGlobalScope.h"
38 #include "V8XPathNSResolver.h" 38 #include "V8XPathNSResolver.h"
39 #include "bindings/v8/ScriptController.h" 39 #include "bindings/v8/ScriptController.h"
40 #include "bindings/v8/V8NodeFilterCondition.h" 40 #include "bindings/v8/V8NodeFilterCondition.h"
41 #include "bindings/v8/V8ObjectConstructor.h" 41 #include "bindings/v8/V8ObjectConstructor.h"
42 #include "bindings/v8/V8WindowShell.h" 42 #include "bindings/v8/V8WindowShell.h"
43 #include "bindings/v8/WorkerScriptController.h" 43 #include "bindings/v8/WorkerScriptController.h"
44 #include "bindings/v8/custom/V8CustomXPathNSResolver.h" 44 #include "bindings/v8/custom/V8CustomXPathNSResolver.h"
45 #include "core/dom/DOMStringList.h" 45 #include "core/dom/DOMStringList.h"
46 #include "core/dom/Element.h" 46 #include "core/dom/Element.h"
47 #include "core/dom/NodeFilter.h" 47 #include "core/dom/NodeFilter.h"
48 #include "core/dom/QualifiedName.h" 48 #include "core/dom/QualifiedName.h"
49 #include "core/dom/WebCoreMemoryInstrumentation.h" 49 #include "core/dom/WebCoreMemoryInstrumentation.h"
50 #include "core/inspector/BindingVisitors.h" 50 #include "core/inspector/BindingVisitors.h"
51 #include "core/loader/FrameLoader.h" 51 #include "core/loader/FrameLoader.h"
52 #include "core/loader/FrameLoaderClient.h" 52 #include "core/loader/FrameLoaderClient.h"
53 #include "core/page/Frame.h" 53 #include "core/page/Frame.h"
54 #include "core/page/Settings.h" 54 #include "core/page/Settings.h"
55 #include "core/workers/WorkerContext.h" 55 #include "core/workers/WorkerGlobalScope.h"
56 #include "core/xml/XPathNSResolver.h" 56 #include "core/xml/XPathNSResolver.h"
57 #include "wtf/MainThread.h" 57 #include "wtf/MainThread.h"
58 #include "wtf/MathExtras.h" 58 #include "wtf/MathExtras.h"
59 #include "wtf/StdLibExtras.h" 59 #include "wtf/StdLibExtras.h"
60 #include "wtf/Threading.h" 60 #include "wtf/Threading.h"
61 #include "wtf/text/AtomicString.h" 61 #include "wtf/text/AtomicString.h"
62 #include "wtf/text/CString.h" 62 #include "wtf/text/CString.h"
63 #include "wtf/text/StringBuffer.h" 63 #include "wtf/text/StringBuffer.h"
64 #include "wtf/text/StringHash.h" 64 #include "wtf/text/StringHash.h"
65 #include "wtf/text/WTFString.h" 65 #include "wtf/text/WTFString.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context> context ) 394 ScriptExecutionContext* toScriptExecutionContext(v8::Handle<v8::Context> context )
395 { 395 {
396 v8::Handle<v8::Object> global = context->Global(); 396 v8::Handle<v8::Object> global = context->Global();
397 v8::Handle<v8::Object> windowWrapper = global->FindInstanceInPrototypeChain( V8Window::GetTemplate(context->GetIsolate(), MainWorld)); 397 v8::Handle<v8::Object> windowWrapper = global->FindInstanceInPrototypeChain( V8Window::GetTemplate(context->GetIsolate(), MainWorld));
398 if (!windowWrapper.IsEmpty()) 398 if (!windowWrapper.IsEmpty())
399 return V8Window::toNative(windowWrapper)->scriptExecutionContext(); 399 return V8Window::toNative(windowWrapper)->scriptExecutionContext();
400 windowWrapper = global->FindInstanceInPrototypeChain(V8Window::GetTemplate(c ontext->GetIsolate(), IsolatedWorld)); 400 windowWrapper = global->FindInstanceInPrototypeChain(V8Window::GetTemplate(c ontext->GetIsolate(), IsolatedWorld));
401 if (!windowWrapper.IsEmpty()) 401 if (!windowWrapper.IsEmpty())
402 return V8Window::toNative(windowWrapper)->scriptExecutionContext(); 402 return V8Window::toNative(windowWrapper)->scriptExecutionContext();
403 v8::Handle<v8::Object> workerWrapper = global->FindInstanceInPrototypeChain( V8WorkerContext::GetTemplate(context->GetIsolate(), WorkerWorld)); 403 v8::Handle<v8::Object> workerWrapper = global->FindInstanceInPrototypeChain( V8WorkerGlobalScope::GetTemplate(context->GetIsolate(), WorkerWorld));
404 if (!workerWrapper.IsEmpty()) 404 if (!workerWrapper.IsEmpty())
405 return V8WorkerContext::toNative(workerWrapper)->scriptExecutionContext( ); 405 return V8WorkerGlobalScope::toNative(workerWrapper)->scriptExecutionCont ext();
406 // FIXME: Is this line of code reachable? 406 // FIXME: Is this line of code reachable?
407 return 0; 407 return 0;
408 } 408 }
409 409
410 DOMWindow* activeDOMWindow() 410 DOMWindow* activeDOMWindow()
411 { 411 {
412 v8::Handle<v8::Context> context = v8::Context::GetCalling(); 412 v8::Handle<v8::Context> context = v8::Context::GetCalling();
413 if (context.IsEmpty()) { 413 if (context.IsEmpty()) {
414 // Unfortunately, when processing script from a plug-in, we might not 414 // Unfortunately, when processing script from a plug-in, we might not
415 // have a calling context. In those cases, we fall back to the 415 // have a calling context. In those cases, we fall back to the
(...skipping 23 matching lines...) Expand all
439 // navigated to another security origin. 439 // navigated to another security origin.
440 return 0; 440 return 0;
441 } 441 }
442 442
443 v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, DOMWrapperWo rld* world) 443 v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, DOMWrapperWo rld* world)
444 { 444 {
445 if (context->isDocument()) { 445 if (context->isDocument()) {
446 ASSERT(world); 446 ASSERT(world);
447 if (Frame* frame = toDocument(context)->frame()) 447 if (Frame* frame = toDocument(context)->frame())
448 return frame->script()->windowShell(world)->context(); 448 return frame->script()->windowShell(world)->context();
449 } else if (context->isWorkerContext()) { 449 } else if (context->isWorkerGlobalScope()) {
450 ASSERT(!world); 450 ASSERT(!world);
451 if (WorkerScriptController* script = static_cast<WorkerContext*>(context )->script()) 451 if (WorkerScriptController* script = static_cast<WorkerGlobalScope*>(con text)->script())
452 return script->context(); 452 return script->context();
453 } 453 }
454 return v8::Local<v8::Context>(); 454 return v8::Local<v8::Context>();
455 } 455 }
456 456
457 bool handleOutOfMemory() 457 bool handleOutOfMemory()
458 { 458 {
459 v8::Local<v8::Context> context = v8::Context::GetCurrent(); 459 v8::Local<v8::Context> context = v8::Context::GetCurrent();
460 460
461 if (!context->HasOutOfMemoryException()) 461 if (!context->HasOutOfMemoryException())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 514 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
515 if (data->workerDOMDataStore()) 515 if (data->workerDOMDataStore())
516 return 0; 516 return 0;
517 if (!DOMWrapperWorld::isolatedWorldsExist()) 517 if (!DOMWrapperWorld::isolatedWorldsExist())
518 return 0; 518 return 0;
519 ASSERT(!v8::Context::GetEntered().IsEmpty()); 519 ASSERT(!v8::Context::GetEntered().IsEmpty());
520 return DOMWrapperWorld::isolatedWorld(v8::Context::GetEntered()); 520 return DOMWrapperWorld::isolatedWorld(v8::Context::GetEntered());
521 } 521 }
522 522
523 } // namespace WebCore 523 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8AbstractEventListener.cpp ('k') | Source/bindings/v8/V8EventListenerList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698