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

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

Issue 209713003: Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 { 542 {
543 DOMWindow* window = toDOMWindow(context); 543 DOMWindow* window = toDOMWindow(context);
544 if (window && window->isCurrentlyDisplayedInFrame()) 544 if (window && window->isCurrentlyDisplayedInFrame())
545 return window->frame(); 545 return window->frame();
546 // We return 0 here because |context| is detached from the LocalFrame. If we 546 // We return 0 here because |context| is detached from the LocalFrame. If we
547 // did return |frame| we could get in trouble because the frame could be 547 // did return |frame| we could get in trouble because the frame could be
548 // navigated to another security origin. 548 // navigated to another security origin.
549 return 0; 549 return 0;
550 } 550 }
551 551
552 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld* w orld) 552 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w orld)
553 { 553 {
554 ASSERT(context); 554 ASSERT(context);
555 if (context->isDocument()) { 555 if (context->isDocument()) {
556 if (LocalFrame* frame = toDocument(context)->frame()) 556 if (LocalFrame* frame = toDocument(context)->frame())
557 return frame->script().windowShell(world)->context(); 557 return frame->script().windowShell(world)->context();
558 } else if (context->isWorkerGlobalScope()) { 558 } else if (context->isWorkerGlobalScope()) {
559 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip t()) 559 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip t())
560 return script->context(); 560 return script->context();
561 } 561 }
562 return v8::Local<v8::Context>(); 562 return v8::Local<v8::Context>();
563 } 563 }
564 564
565 v8::Local<v8::Context> toV8Context(v8::Isolate* isolate, LocalFrame* frame, DOMW rapperWorld* world) 565 v8::Local<v8::Context> toV8Context(v8::Isolate* isolate, LocalFrame* frame, DOMW rapperWorld& world)
566 { 566 {
567 if (!frame) 567 if (!frame)
568 return v8::Local<v8::Context>(); 568 return v8::Local<v8::Context>();
569 v8::Local<v8::Context> context = frame->script().windowShell(world)->context (); 569 v8::Local<v8::Context> context = frame->script().windowShell(world)->context ();
570 if (context.IsEmpty()) 570 if (context.IsEmpty())
571 return v8::Local<v8::Context>(); 571 return v8::Local<v8::Context>();
572 LocalFrame* attachedFrame= toFrameIfNotDetached(context); 572 LocalFrame* attachedFrame= toFrameIfNotDetached(context);
573 return frame == attachedFrame ? context : v8::Local<v8::Context>(); 573 return frame == attachedFrame ? context : v8::Local<v8::Context>();
574 } 574 }
575 575
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 V8ExecutionScope::V8ExecutionScope(v8::Isolate* isolate) 657 V8ExecutionScope::V8ExecutionScope(v8::Isolate* isolate)
658 : m_handleScope(isolate) 658 : m_handleScope(isolate)
659 , m_context(v8::Context::New(isolate)) 659 , m_context(v8::Context::New(isolate))
660 , m_contextScope(m_context) 660 , m_contextScope(m_context)
661 , m_world(DOMWrapperWorld::create()) 661 , m_world(DOMWrapperWorld::create())
662 , m_perContextData(V8PerContextData::create(m_context, m_world)) 662 , m_perContextData(V8PerContextData::create(m_context, m_world))
663 { 663 {
664 } 664 }
665 665
666 } // namespace WebCore 666 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8CustomElementLifecycleCallbacks.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698