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

Side by Side Diff: Source/core/inspector/InspectorOverlay.cpp

Issue 33523002: Have Frame::script() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 frame->init(); 645 frame->init();
646 FrameLoader* loader = frame->loader(); 646 FrameLoader* loader = frame->loader();
647 frame->view()->setCanHaveScrollbars(false); 647 frame->view()->setCanHaveScrollbars(false);
648 frame->view()->setTransparent(true); 648 frame->view()->setTransparent(true);
649 ASSERT(loader->activeDocumentLoader()); 649 ASSERT(loader->activeDocumentLoader());
650 DocumentWriter* writer = loader->activeDocumentLoader()->beginWriting("text/ html", "UTF-8"); 650 DocumentWriter* writer = loader->activeDocumentLoader()->beginWriting("text/ html", "UTF-8");
651 writer->addData(reinterpret_cast<const char*>(InspectorOverlayPage_html), si zeof(InspectorOverlayPage_html)); 651 writer->addData(reinterpret_cast<const char*>(InspectorOverlayPage_html), si zeof(InspectorOverlayPage_html));
652 loader->activeDocumentLoader()->endWriting(writer); 652 loader->activeDocumentLoader()->endWriting(writer);
653 v8::Isolate* isolate = toIsolate(frame.get()); 653 v8::Isolate* isolate = toIsolate(frame.get());
654 v8::HandleScope handleScope(isolate); 654 v8::HandleScope handleScope(isolate);
655 v8::Handle<v8::Context> frameContext = frame->script()->currentWorldContext( ); 655 v8::Handle<v8::Context> frameContext = frame->script().currentWorldContext() ;
656 v8::Context::Scope contextScope(frameContext); 656 v8::Context::Scope contextScope(frameContext);
657 v8::Handle<v8::Value> overlayHostObj = toV8(m_overlayHost.get(), v8::Handle< v8::Object>(), isolate); 657 v8::Handle<v8::Value> overlayHostObj = toV8(m_overlayHost.get(), v8::Handle< v8::Object>(), isolate);
658 v8::Handle<v8::Object> global = frameContext->Global(); 658 v8::Handle<v8::Object> global = frameContext->Global();
659 global->Set(v8::String::New("InspectorOverlayHost"), overlayHostObj); 659 global->Set(v8::String::New("InspectorOverlayHost"), overlayHostObj);
660 660
661 #if OS(WIN) 661 #if OS(WIN)
662 evaluateInOverlay("setPlatform", "windows"); 662 evaluateInOverlay("setPlatform", "windows");
663 #elif OS(MACOSX) 663 #elif OS(MACOSX)
664 evaluateInOverlay("setPlatform", "mac"); 664 evaluateInOverlay("setPlatform", "mac");
665 #elif OS(POSIX) 665 #elif OS(POSIX)
(...skipping 14 matching lines...) Expand all
680 resetData->setNumber("scrollX", scrollX); 680 resetData->setNumber("scrollX", scrollX);
681 resetData->setNumber("scrollY", scrollY); 681 resetData->setNumber("scrollY", scrollY);
682 evaluateInOverlay("reset", resetData.release()); 682 evaluateInOverlay("reset", resetData.release());
683 } 683 }
684 684
685 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument) 685 void InspectorOverlay::evaluateInOverlay(const String& method, const String& arg ument)
686 { 686 {
687 RefPtr<JSONArray> command = JSONArray::create(); 687 RefPtr<JSONArray> command = JSONArray::create();
688 command->pushString(method); 688 command->pushString(method);
689 command->pushString(argument); 689 command->pushString(argument);
690 overlayPage()->mainFrame()->script()->executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisabl ed); 690 overlayPage()->mainFrame()->script().executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisable d);
691 } 691 }
692 692
693 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<JSONVa lue> argument) 693 void InspectorOverlay::evaluateInOverlay(const String& method, PassRefPtr<JSONVa lue> argument)
694 { 694 {
695 RefPtr<JSONArray> command = JSONArray::create(); 695 RefPtr<JSONArray> command = JSONArray::create();
696 command->pushString(method); 696 command->pushString(method);
697 command->pushValue(argument); 697 command->pushValue(argument);
698 overlayPage()->mainFrame()->script()->executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisabl ed); 698 overlayPage()->mainFrame()->script().executeScriptInMainWorld("dispatch(" + command->toJSONString() + ")", ScriptController::ExecuteScriptWhenScriptsDisable d);
699 } 699 }
700 700
701 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*) 701 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*)
702 { 702 {
703 m_drawViewSize = false; 703 m_drawViewSize = false;
704 update(); 704 update();
705 } 705 }
706 706
707 bool InspectorOverlay::getBoxModel(Node* node, Vector<FloatQuad>* quads) 707 bool InspectorOverlay::getBoxModel(Node* node, Vector<FloatQuad>* quads)
708 { 708 {
709 return buildNodeQuads(node, *quads); 709 return buildNodeQuads(node, *quads);
710 } 710 }
711 711
712 void InspectorOverlay::freePage() 712 void InspectorOverlay::freePage()
713 { 713 {
714 m_overlayPage.clear(); 714 m_overlayPage.clear();
715 m_overlayChromeClient.clear(); 715 m_overlayChromeClient.clear();
716 m_timer.stop(); 716 m_timer.stop();
717 } 717 }
718 718
719 } // namespace WebCore 719 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorIndexedDBAgent.cpp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698