third_party/re2: Remove remove-static-initializers.patch.
[chromium-blink-merge.git] / content / renderer / child_frame_compositing_helper.h
blob0700d9cc24f6f57195c730be6e1a0225ececae59
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_
6 #define CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/shared_memory.h"
14 #include "cc/layers/delegated_frame_resource_collection.h"
15 #include "content/common/content_export.h"
16 #include "ui/gfx/geometry/size.h"
18 namespace base {
19 class SharedMemory;
22 namespace cc {
23 class CompositorFrame;
24 class Layer;
25 class SolidColorLayer;
26 class DelegatedFrameProvider;
27 class DelegatedFrameResourceCollection;
28 class DelegatedRendererLayer;
31 namespace blink {
32 class WebFrame;
33 class WebPluginContainer;
34 class WebLayer;
37 namespace gfx {
38 class Rect;
39 class Size;
42 struct FrameHostMsg_CompositorFrameSwappedACK_Params;
43 struct FrameHostMsg_BuffersSwappedACK_Params;
44 struct FrameHostMsg_ReclaimCompositorResources_Params;
46 namespace content {
48 class BrowserPlugin;
49 class BrowserPluginManager;
50 class RenderFrameProxy;
52 class CONTENT_EXPORT ChildFrameCompositingHelper
53 : public base::RefCounted<ChildFrameCompositingHelper>,
54 public cc::DelegatedFrameResourceCollectionClient {
55 public:
56 static ChildFrameCompositingHelper* CreateForBrowserPlugin(
57 const base::WeakPtr<BrowserPlugin>& browser_plugin);
58 static ChildFrameCompositingHelper* CreateForRenderFrameProxy(
59 RenderFrameProxy* render_frame_proxy);
61 void DidCommitCompositorFrame();
62 void EnableCompositing(bool);
63 void OnContainerDestroy();
64 void OnCompositorFrameSwapped(scoped_ptr<cc::CompositorFrame> frame,
65 int route_id,
66 uint32 output_surface_id,
67 int host_id,
68 base::SharedMemoryHandle handle);
69 void UpdateVisibility(bool);
70 void ChildFrameGone();
72 // cc::DelegatedFrameProviderClient implementation.
73 void UnusedResourcesAreAvailable() override;
74 void SetContentsOpaque(bool);
76 protected:
77 // Friend RefCounted so that the dtor can be non-public.
78 friend class base::RefCounted<ChildFrameCompositingHelper>;
80 private:
81 ChildFrameCompositingHelper(
82 const base::WeakPtr<BrowserPlugin>& browser_plugin,
83 blink::WebFrame* frame,
84 RenderFrameProxy* render_frame_proxy,
85 int host_routing_id);
87 virtual ~ChildFrameCompositingHelper();
89 BrowserPluginManager* GetBrowserPluginManager();
90 blink::WebPluginContainer* GetContainer();
91 int GetInstanceID();
93 void SendCompositorFrameSwappedACKToBrowser(
94 FrameHostMsg_CompositorFrameSwappedACK_Params& params);
95 void SendReclaimCompositorResourcesToBrowser(
96 FrameHostMsg_ReclaimCompositorResources_Params& params);
97 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size,
98 float device_scale_factor,
99 cc::Layer* layer);
100 void SendReturnedDelegatedResources();
102 int host_routing_id_;
103 int last_route_id_;
104 uint32 last_output_surface_id_;
105 int last_host_id_;
106 bool ack_pending_;
107 bool opaque_;
109 gfx::Size buffer_size_;
111 // The lifetime of this weak pointer should be greater than the lifetime of
112 // other member objects, as they may access this pointer during their
113 // destruction.
114 base::WeakPtr<BrowserPlugin> browser_plugin_;
115 RenderFrameProxy* render_frame_proxy_;
117 scoped_refptr<cc::DelegatedFrameResourceCollection> resource_collection_;
118 scoped_refptr<cc::DelegatedFrameProvider> frame_provider_;
120 scoped_refptr<cc::SolidColorLayer> background_layer_;
121 scoped_refptr<cc::DelegatedRendererLayer> delegated_layer_;
122 scoped_ptr<blink::WebLayer> web_layer_;
123 blink::WebFrame* frame_;
125 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper);
128 } // namespace content
130 #endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_