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

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2849403002: Use const ref for LocalFrame::LocalFrameRoot and FrameTree::Top (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
9 * rights reserved. 9 * rights reserved.
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 return LayoutViewItem(ContentLayoutObject()); 560 return LayoutViewItem(ContentLayoutObject());
561 } 561 }
562 562
563 void LocalFrame::DidChangeVisibilityState() { 563 void LocalFrame::DidChangeVisibilityState() {
564 if (GetDocument()) 564 if (GetDocument())
565 GetDocument()->DidChangeVisibilityState(); 565 GetDocument()->DidChangeVisibilityState();
566 566
567 Frame::DidChangeVisibilityState(); 567 Frame::DidChangeVisibilityState();
568 } 568 }
569 569
570 LocalFrame* LocalFrame::LocalFrameRoot() { 570 LocalFrame& LocalFrame::LocalFrameRoot() const {
571 LocalFrame* cur_frame = this; 571 const LocalFrame* cur_frame = this;
572 while (cur_frame && cur_frame->Tree().Parent() && 572 while (cur_frame && cur_frame->Tree().Parent() &&
573 cur_frame->Tree().Parent()->IsLocalFrame()) 573 cur_frame->Tree().Parent()->IsLocalFrame())
574 cur_frame = ToLocalFrame(cur_frame->Tree().Parent()); 574 cur_frame = ToLocalFrame(cur_frame->Tree().Parent());
575 575
576 return cur_frame; 576 return const_cast<LocalFrame&>(*cur_frame);
577 } 577 }
578 578
579 bool LocalFrame::IsCrossOriginSubframe() const { 579 bool LocalFrame::IsCrossOriginSubframe() const {
580 const SecurityOrigin* security_origin = 580 const SecurityOrigin* security_origin =
581 GetSecurityContext()->GetSecurityOrigin(); 581 GetSecurityContext()->GetSecurityOrigin();
582 Frame* top = Tree().Top(); 582 return !security_origin->CanAccess(
583 return top && !security_origin->CanAccess( 583 Tree().Top().GetSecurityContext()->GetSecurityOrigin());
584 top->GetSecurityContext()->GetSecurityOrigin());
585 } 584 }
586 585
587 void LocalFrame::SetPrinting(bool printing, 586 void LocalFrame::SetPrinting(bool printing,
588 const FloatSize& page_size, 587 const FloatSize& page_size,
589 const FloatSize& original_page_size, 588 const FloatSize& original_page_size,
590 float maximum_shrink_ratio) { 589 float maximum_shrink_ratio) {
591 // In setting printing, we should not validate resources already cached for 590 // In setting printing, we should not validate resources already cached for
592 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704 591 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704
593 ResourceCacheValidationSuppressor validation_suppressor( 592 ResourceCacheValidationSuppressor validation_suppressor(
594 GetDocument()->Fetcher()); 593 GetDocument()->Fetcher());
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 navigation_disable_count_(0), 893 navigation_disable_count_(0),
895 page_zoom_factor_(ParentPageZoomFactor(this)), 894 page_zoom_factor_(ParentPageZoomFactor(this)),
896 text_zoom_factor_(ParentTextZoomFactor(this)), 895 text_zoom_factor_(ParentTextZoomFactor(this)),
897 in_view_source_mode_(false), 896 in_view_source_mode_(false),
898 interface_provider_(interface_provider), 897 interface_provider_(interface_provider),
899 interface_registry_(interface_registry) { 898 interface_registry_(interface_registry) {
900 if (IsLocalRoot()) { 899 if (IsLocalRoot()) {
901 instrumenting_agents_ = new CoreProbeSink(); 900 instrumenting_agents_ = new CoreProbeSink();
902 performance_monitor_ = new PerformanceMonitor(this); 901 performance_monitor_ = new PerformanceMonitor(this);
903 } else { 902 } else {
904 instrumenting_agents_ = LocalFrameRoot()->instrumenting_agents_; 903 instrumenting_agents_ = LocalFrameRoot().instrumenting_agents_;
905 performance_monitor_ = LocalFrameRoot()->performance_monitor_; 904 performance_monitor_ = LocalFrameRoot().performance_monitor_;
906 } 905 }
907 } 906 }
908 907
909 WebFrameScheduler* LocalFrame::FrameScheduler() { 908 WebFrameScheduler* LocalFrame::FrameScheduler() {
910 return frame_scheduler_.get(); 909 return frame_scheduler_.get();
911 } 910 }
912 911
913 void LocalFrame::ScheduleVisualUpdateUnlessThrottled() { 912 void LocalFrame::ScheduleVisualUpdateUnlessThrottled() {
914 if (ShouldThrottleRendering()) 913 if (ShouldThrottleRendering())
915 return; 914 return;
916 GetPage()->Animator().ScheduleVisualUpdate(this); 915 GetPage()->Animator().ScheduleVisualUpdate(this);
917 } 916 }
918 917
919 LocalFrameClient* LocalFrame::Client() const { 918 LocalFrameClient* LocalFrame::Client() const {
920 return static_cast<LocalFrameClient*>(Frame::Client()); 919 return static_cast<LocalFrameClient*>(Frame::Client());
921 } 920 }
922 921
923 ContentSettingsClient* LocalFrame::GetContentSettingsClient() { 922 ContentSettingsClient* LocalFrame::GetContentSettingsClient() {
924 return Client() ? &Client()->GetContentSettingsClient() : nullptr; 923 return Client() ? &Client()->GetContentSettingsClient() : nullptr;
925 } 924 }
926 925
927 PluginData* LocalFrame::GetPluginData() const { 926 PluginData* LocalFrame::GetPluginData() const {
928 if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) 927 if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
929 return nullptr; 928 return nullptr;
930 return GetPage()->GetPluginData( 929 return GetPage()->GetPluginData(
931 Tree().Top()->GetSecurityContext()->GetSecurityOrigin()); 930 Tree().Top().GetSecurityContext()->GetSecurityOrigin());
932 } 931 }
933 932
934 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); 933 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame);
935 934
936 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) 935 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame)
937 : frame_(&frame) { 936 : frame_(&frame) {
938 frame_->DisableNavigation(); 937 frame_->DisableNavigation();
939 } 938 }
940 939
941 FrameNavigationDisabler::~FrameNavigationDisabler() { 940 FrameNavigationDisabler::~FrameNavigationDisabler() {
942 frame_->EnableNavigation(); 941 frame_->EnableNavigation();
943 } 942 }
944 943
945 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame) : frame_(frame) { 944 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame) : frame_(frame) {
946 if (frame_ && frame_->Client() && frame_->Client()->GetFrameBlameContext()) 945 if (frame_ && frame_->Client() && frame_->Client()->GetFrameBlameContext())
947 frame_->Client()->GetFrameBlameContext()->Enter(); 946 frame_->Client()->GetFrameBlameContext()->Enter();
948 } 947 }
949 948
950 ScopedFrameBlamer::~ScopedFrameBlamer() { 949 ScopedFrameBlamer::~ScopedFrameBlamer() {
951 if (frame_ && frame_->Client() && frame_->Client()->GetFrameBlameContext()) 950 if (frame_ && frame_->Client() && frame_->Client()->GetFrameBlameContext())
952 frame_->Client()->GetFrameBlameContext()->Leave(); 951 frame_->Client()->GetFrameBlameContext()->Leave();
953 } 952 }
954 953
955 } // namespace blink 954 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698