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

Side by Side Diff: Source/web/WebRemoteFrameImpl.cpp

Issue 910313004: Replace PlaceholderFrameOwner with RemoteBridgeFrameOwner. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "web/WebRemoteFrameImpl.h" 6 #include "web/WebRemoteFrameImpl.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/RemoteFrame.h" 9 #include "core/frame/RemoteFrame.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
11 #include "core/page/Page.h" 11 #include "core/page/Page.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "public/platform/WebFloatRect.h" 13 #include "public/platform/WebFloatRect.h"
14 #include "public/platform/WebRect.h" 14 #include "public/platform/WebRect.h"
15 #include "public/web/WebDocument.h" 15 #include "public/web/WebDocument.h"
16 #include "public/web/WebPerformance.h" 16 #include "public/web/WebPerformance.h"
17 #include "public/web/WebRange.h" 17 #include "public/web/WebRange.h"
18 #include "web/WebLocalFrameImpl.h"
19 #include "web/WebViewImpl.h" 18 #include "web/WebViewImpl.h"
20 #include <v8/include/v8.h> 19 #include <v8/include/v8.h>
21 20
22 namespace blink { 21 namespace blink {
23 22
24 namespace {
25
26 // Helper class to bridge communication for a local frame with a remote parent.
27 // Currently, it serves two purposes:
28 // 1. Allows the local frame's loader to retrieve sandbox flags associated with
29 // its owner element in another process.
30 // 2. Trigger a load event on its owner element once it finishes a load.
31 class RemoteBridgeFrameOwner : public NoBaseWillBeGarbageCollectedFinalized<Remo teBridgeFrameOwner>, public FrameOwner {
32 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RemoteBridgeFrameOwner);
33 public:
34 static PassOwnPtrWillBeRawPtr<RemoteBridgeFrameOwner> create(PassRefPtrWillB eRawPtr<WebLocalFrameImpl> frame, SandboxFlags flags)
35 {
36 return adoptPtrWillBeNoop(new RemoteBridgeFrameOwner(frame, flags));
37 }
38
39 virtual bool isLocal() const override
40 {
41 return false;
42 }
43
44 virtual SandboxFlags sandboxFlags() const override
45 {
46 return m_sandboxFlags;
47 }
48
49 void setSandboxFlags(SandboxFlags flags)
50 {
51 m_sandboxFlags = flags;
52 }
53
54 virtual void dispatchLoad() override;
55
56 virtual void trace(Visitor*);
57
58 private:
59 explicit RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFrameImpl>, S andboxFlags);
60
61 RefPtrWillBeMember<WebLocalFrameImpl> m_frame;
62 SandboxFlags m_sandboxFlags;
63 };
64
65 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame, SandboxFlags flags) 23 RemoteBridgeFrameOwner::RemoteBridgeFrameOwner(PassRefPtrWillBeRawPtr<WebLocalFr ameImpl> frame, SandboxFlags flags)
66 : m_frame(frame) 24 : m_frame(frame)
67 , m_sandboxFlags(flags) 25 , m_sandboxFlags(flags)
68 { 26 {
69 } 27 }
70 28
71 void RemoteBridgeFrameOwner::trace(Visitor* visitor) 29 void RemoteBridgeFrameOwner::trace(Visitor* visitor)
72 { 30 {
73 visitor->trace(m_frame); 31 visitor->trace(m_frame);
74 FrameOwner::trace(visitor); 32 FrameOwner::trace(visitor);
75 } 33 }
76 34
77 void RemoteBridgeFrameOwner::dispatchLoad() 35 void RemoteBridgeFrameOwner::dispatchLoad()
78 { 36 {
79 // FIXME: Implement. Most likely goes through m_frame->client(). 37 // FIXME: Implement. Most likely goes through m_frame->client().
80 } 38 }
81 39
82 } // namespace
83
84 bool PlaceholderFrameOwner::isLocal() const
85 {
86 return false;
87 }
88
89 SandboxFlags PlaceholderFrameOwner::sandboxFlags() const
90 {
91 return 0;
92 }
93
94 void PlaceholderFrameOwner::dispatchLoad()
95 {
96 }
97
98 void PlaceholderFrameOwner::trace(Visitor* visitor)
99 {
100 FrameOwner::trace(visitor);
101 }
102
103 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client) 40 WebRemoteFrame* WebRemoteFrame::create(WebRemoteFrameClient* client)
104 { 41 {
105 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client); 42 WebRemoteFrameImpl* frame = new WebRemoteFrameImpl(client);
106 #if ENABLE(OILPAN) 43 #if ENABLE(OILPAN)
107 return frame; 44 return frame;
108 #else 45 #else
109 return adoptRef(frame).leakRef(); 46 return adoptRef(frame).leakRef();
110 #endif 47 #endif
111 } 48 }
112 49
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 ASSERT(child->frame()); 751 ASSERT(child->frame());
815 return child; 752 return child;
816 } 753 }
817 754
818 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name) 755 void WebRemoteFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name)
819 { 756 {
820 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner)); 757 setCoreFrame(RemoteFrame::create(&m_frameClient, host, owner));
821 m_frame->tree().setName(name, nullAtom); 758 m_frame->tree().setName(name, nullAtom);
822 } 759 }
823 760
761 // FIXME(alexmos): remove once Chrome side is updated to use sandbox flags.
824 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web RemoteFrameClient* client) 762 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web RemoteFrameClient* client)
825 { 763 {
764 return createRemoteChild(name, WebSandboxFlags::None, client);
765 }
766
767 WebRemoteFrame* WebRemoteFrameImpl::createRemoteChild(const WebString& name, Web SandboxFlags sandboxFlags, WebRemoteFrameClient* client)
768 {
826 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie nt)); 769 WebRemoteFrameImpl* child = toWebRemoteFrameImpl(WebRemoteFrame::create(clie nt));
827 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu lt = 770 WillBeHeapHashMap<WebFrame*, OwnPtrWillBeMember<FrameOwner>>::AddResult resu lt =
828 m_ownersForChildren.add(child, adoptPtrWillBeNoop(new PlaceholderFrameOw ner)); 771 m_ownersForChildren.add(child, RemoteBridgeFrameOwner::create(nullptr, s tatic_cast<SandboxFlags>(sandboxFlags)));
829 appendChild(child); 772 appendChild(child);
830 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name); 773 child->initializeCoreFrame(frame()->host(), result.storedValue->value.get(), name);
831 return child; 774 return child;
832 } 775 }
833 776
834 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame) 777 void WebRemoteFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<RemoteFrame> frame)
835 { 778 {
836 m_frame = frame; 779 m_frame = frame;
837 } 780 }
838 781
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 { 822 {
880 frame()->setIsLoading(false); 823 frame()->setIsLoading(false);
881 if (parent() && parent()->isWebLocalFrame()) { 824 if (parent() && parent()->isWebLocalFrame()) {
882 WebLocalFrameImpl* parentFrame = 825 WebLocalFrameImpl* parentFrame =
883 toWebLocalFrameImpl(parent()->toWebLocalFrame()); 826 toWebLocalFrameImpl(parent()->toWebLocalFrame());
884 parentFrame->frame()->loader().checkCompleted(); 827 parentFrame->frame()->loader().checkCompleted();
885 } 828 }
886 } 829 }
887 830
888 } // namespace blink 831 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698