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

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

Issue 334283004: Rename DOMWindow to LocalDOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value, v8::Isolate* isolate) 520 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Handle<v8::Value> value, v8::Isolate* isolate)
521 { 521 {
522 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr; 522 RefPtrWillBeRawPtr<XPathNSResolver> resolver = nullptr;
523 if (V8XPathNSResolver::hasInstance(value, isolate)) 523 if (V8XPathNSResolver::hasInstance(value, isolate))
524 resolver = V8XPathNSResolver::toNative(v8::Handle<v8::Object>::Cast(valu e)); 524 resolver = V8XPathNSResolver::toNative(v8::Handle<v8::Object>::Cast(valu e));
525 else if (value->IsObject()) 525 else if (value->IsObject())
526 resolver = V8CustomXPathNSResolver::create(value->ToObject(), isolate); 526 resolver = V8CustomXPathNSResolver::create(value->ToObject(), isolate);
527 return resolver; 527 return resolver;
528 } 528 }
529 529
530 DOMWindow* toDOMWindow(v8::Handle<v8::Value> value, v8::Isolate* isolate) 530 LocalDOMWindow* toDOMWindow(v8::Handle<v8::Value> value, v8::Isolate* isolate)
531 { 531 {
532 if (value.IsEmpty() || !value->IsObject()) 532 if (value.IsEmpty() || !value->IsObject())
533 return 0; 533 return 0;
534 534
535 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai n(v8::Handle<v8::Object>::Cast(value), isolate); 535 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototypeChai n(v8::Handle<v8::Object>::Cast(value), isolate);
536 if (!windowWrapper.IsEmpty()) 536 if (!windowWrapper.IsEmpty())
537 return V8Window::toNative(windowWrapper); 537 return V8Window::toNative(windowWrapper);
538 return 0; 538 return 0;
539 } 539 }
540 540
541 DOMWindow* toDOMWindow(v8::Handle<v8::Context> context) 541 LocalDOMWindow* toDOMWindow(v8::Handle<v8::Context> context)
542 { 542 {
543 if (context.IsEmpty()) 543 if (context.IsEmpty())
544 return 0; 544 return 0;
545 return toDOMWindow(context->Global(), context->GetIsolate()); 545 return toDOMWindow(context->Global(), context->GetIsolate());
546 } 546 }
547 547
548 DOMWindow* enteredDOMWindow(v8::Isolate* isolate) 548 LocalDOMWindow* enteredDOMWindow(v8::Isolate* isolate)
549 { 549 {
550 DOMWindow* window = toDOMWindow(isolate->GetEnteredContext()); 550 LocalDOMWindow* window = toDOMWindow(isolate->GetEnteredContext());
551 if (!window) { 551 if (!window) {
552 // We don't always have an entered DOM window, for example during microt ask callbacks from V8 552 // We don't always have an entered DOM window, for example during microt ask callbacks from V8
553 // (where the entered context may be the DOM-in-JS context). In that cas e, we fall back 553 // (where the entered context may be the DOM-in-JS context). In that cas e, we fall back
554 // to the current context. 554 // to the current context.
555 window = currentDOMWindow(isolate); 555 window = currentDOMWindow(isolate);
556 ASSERT(window); 556 ASSERT(window);
557 } 557 }
558 return window; 558 return window;
559 } 559 }
560 560
561 DOMWindow* currentDOMWindow(v8::Isolate* isolate) 561 LocalDOMWindow* currentDOMWindow(v8::Isolate* isolate)
562 { 562 {
563 return toDOMWindow(isolate->GetCurrentContext()); 563 return toDOMWindow(isolate->GetCurrentContext());
564 } 564 }
565 565
566 DOMWindow* callingDOMWindow(v8::Isolate* isolate) 566 LocalDOMWindow* callingDOMWindow(v8::Isolate* isolate)
567 { 567 {
568 v8::Handle<v8::Context> context = isolate->GetCallingContext(); 568 v8::Handle<v8::Context> context = isolate->GetCallingContext();
569 if (context.IsEmpty()) { 569 if (context.IsEmpty()) {
570 // Unfortunately, when processing script from a plug-in, we might not 570 // Unfortunately, when processing script from a plug-in, we might not
571 // have a calling context. In those cases, we fall back to the 571 // have a calling context. In those cases, we fall back to the
572 // entered context. 572 // entered context.
573 context = isolate->GetEnteredContext(); 573 context = isolate->GetEnteredContext();
574 } 574 }
575 return toDOMWindow(context); 575 return toDOMWindow(context);
576 } 576 }
(...skipping 23 matching lines...) Expand all
600 // Unfortunately, when processing script from a plug-in, we might not 600 // Unfortunately, when processing script from a plug-in, we might not
601 // have a calling context. In those cases, we fall back to the 601 // have a calling context. In those cases, we fall back to the
602 // entered context. 602 // entered context.
603 context = isolate->GetEnteredContext(); 603 context = isolate->GetEnteredContext();
604 } 604 }
605 return toExecutionContext(context); 605 return toExecutionContext(context);
606 } 606 }
607 607
608 LocalFrame* toFrameIfNotDetached(v8::Handle<v8::Context> context) 608 LocalFrame* toFrameIfNotDetached(v8::Handle<v8::Context> context)
609 { 609 {
610 DOMWindow* window = toDOMWindow(context); 610 LocalDOMWindow* window = toDOMWindow(context);
611 if (window && window->isCurrentlyDisplayedInFrame()) 611 if (window && window->isCurrentlyDisplayedInFrame())
612 return window->frame(); 612 return window->frame();
613 // We return 0 here because |context| is detached from the LocalFrame. If we 613 // We return 0 here because |context| is detached from the LocalFrame. If we
614 // did return |frame| we could get in trouble because the frame could be 614 // did return |frame| we could get in trouble because the frame could be
615 // navigated to another security origin. 615 // navigated to another security origin.
616 return 0; 616 return 0;
617 } 617 }
618 618
619 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w orld) 619 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w orld)
620 { 620 {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate) 810 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(Executio nContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
811 { 811 {
812 int scriptId = 0; 812 int scriptId = 0;
813 String resourceName; 813 String resourceName;
814 int lineNumber = 1; 814 int lineNumber = 1;
815 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r); 815 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumbe r);
816 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber); 816 return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lin eNumber);
817 } 817 }
818 818
819 } // namespace WebCore 819 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698