blob: f3241592479d967031a0f760340007446879d2be [file] [log] [blame]
[email protected]bffc8302014-01-23 20:52:161// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]0f21e8582013-01-11 11:06:562// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]bffc8302014-01-23 20:52:165#ifndef CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_
6#define CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_
[email protected]0f21e8582013-01-11 11:06:567
avi1023d012015-12-25 02:39:148#include <stdint.h>
9
dchengcedca5612016-04-09 01:40:1510#include <memory>
[email protected]0f21e8582013-01-11 11:06:5611#include <string>
[email protected]9afdaef2013-09-26 07:24:3712#include <vector>
[email protected]0f21e8582013-01-11 11:06:5613
avi1023d012015-12-25 02:39:1414#include "base/macros.h"
[email protected]0f21e8582013-01-11 11:06:5615#include "base/memory/ref_counted.h"
[email protected]f1970082014-04-09 04:29:5616#include "base/memory/shared_memory.h"
jbauman68a139e2016-02-09 05:07:2917#include "base/memory/weak_ptr.h"
samans72b2a282016-12-17 02:44:1518#include "cc/surfaces/surface_reference_factory.h"
Fady Samuel644df1d2017-07-13 01:13:0219#include "components/viz/common/surfaces/surface_id.h"
[email protected]0f21e8582013-01-11 11:06:5620#include "content/common/content_export.h"
tfarinaebe974f02015-01-03 04:25:3221#include "ui/gfx/geometry/size.h"
[email protected]0f21e8582013-01-11 11:06:5622
23namespace cc {
kenrbfc7c02c92015-05-29 22:20:5824struct SurfaceSequence;
25
[email protected]f5b4b0f2013-04-02 18:16:2826class Layer;
[email protected]0f21e8582013-01-11 11:06:5627}
28
[email protected]180ef242013-11-07 06:50:4629namespace blink {
[email protected]0f21e8582013-01-11 11:06:5630class WebLayer;
dcheng5cf543012016-11-24 17:13:3731class WebPluginContainer;
32class WebRemoteFrame;
[email protected]0f21e8582013-01-11 11:06:5633}
34
[email protected]73405fb2013-12-11 04:59:3735namespace gfx {
[email protected]73405fb2013-12-11 04:59:3736class Size;
37}
38
Fady Samuel1a21156e2017-07-13 04:57:2939namespace viz {
40class SurfaceInfo;
41}
42
[email protected]0f21e8582013-01-11 11:06:5643namespace content {
44
[email protected]94224ba62014-02-04 00:25:2445class BrowserPlugin;
[email protected]e3244ed2014-06-20 20:04:2746class RenderFrameProxy;
[email protected]0d25cb62013-01-21 15:42:2147
[email protected]bffc8302014-01-23 20:52:1648class CONTENT_EXPORT ChildFrameCompositingHelper
jbauman42dd9fb2016-02-05 01:07:1049 : public base::RefCounted<ChildFrameCompositingHelper> {
[email protected]0f21e8582013-01-11 11:06:5650 public:
[email protected]c092f5c2014-07-18 01:34:3351 static ChildFrameCompositingHelper* CreateForBrowserPlugin(
[email protected]94224ba62014-02-04 00:25:2452 const base::WeakPtr<BrowserPlugin>& browser_plugin);
[email protected]c092f5c2014-07-18 01:34:3353 static ChildFrameCompositingHelper* CreateForRenderFrameProxy(
54 RenderFrameProxy* render_frame_proxy);
[email protected]bffc8302014-01-23 20:52:1655
[email protected]0d25cb62013-01-21 15:42:2156 void OnContainerDestroy();
Fady Samuel1a21156e2017-07-13 04:57:2957 void OnSetSurface(const viz::SurfaceInfo& surface_info,
kenrbfc7c02c92015-05-29 22:20:5858 const cc::SurfaceSequence& sequence);
[email protected]69b79122013-02-14 19:16:4559 void UpdateVisibility(bool);
[email protected]f49722f2014-01-30 17:54:5060 void ChildFrameGone();
[email protected]b0030b72013-11-15 20:35:5361
Fady Samueld5c26182017-07-12 02:43:3362 viz::SurfaceId surface_id() const { return surface_id_; }
lfge6119aac2016-01-27 02:14:3163
[email protected]0d25cb62013-01-21 15:42:2164 protected:
65 // Friend RefCounted so that the dtor can be non-public.
[email protected]bffc8302014-01-23 20:52:1666 friend class base::RefCounted<ChildFrameCompositingHelper>;
67
[email protected]0f21e8582013-01-11 11:06:5668 private:
[email protected]94224ba62014-02-04 00:25:2469 ChildFrameCompositingHelper(
70 const base::WeakPtr<BrowserPlugin>& browser_plugin,
dcheng5cf543012016-11-24 17:13:3771 blink::WebRemoteFrame* frame,
[email protected]e3244ed2014-06-20 20:04:2772 RenderFrameProxy* render_frame_proxy,
[email protected]94224ba62014-02-04 00:25:2473 int host_routing_id);
[email protected]bffc8302014-01-23 20:52:1674
[email protected]bffc8302014-01-23 20:52:1675 virtual ~ChildFrameCompositingHelper();
[email protected]94224ba62014-02-04 00:25:2476
[email protected]94224ba62014-02-04 00:25:2477 blink::WebPluginContainer* GetContainer();
[email protected]94224ba62014-02-04 00:25:2478
[email protected]6d3a46e2013-11-25 23:08:5379 void CheckSizeAndAdjustLayerProperties(const gfx::Size& new_size,
80 float device_scale_factor,
81 cc::Layer* layer);
vmpstre87ffcaa2016-08-23 21:01:1482 void UpdateWebLayer(std::unique_ptr<blink::WebLayer> layer);
kenrbfc7c02c92015-05-29 22:20:5883
samans72b2a282016-12-17 02:44:1584 const int host_routing_id_;
[email protected]0f21e8582013-01-11 11:06:5685
[email protected]c2bfe4e2013-01-16 01:10:2086 gfx::Size buffer_size_;
[email protected]c2bfe4e2013-01-16 01:10:2087
[email protected]bdca9be22014-02-18 00:37:4988 // The lifetime of this weak pointer should be greater than the lifetime of
89 // other member objects, as they may access this pointer during their
90 // destruction.
samans72b2a282016-12-17 02:44:1591 const base::WeakPtr<BrowserPlugin> browser_plugin_;
92 RenderFrameProxy* const render_frame_proxy_;
[email protected]bdca9be22014-02-18 00:37:4993
dchengcedca5612016-04-09 01:40:1594 std::unique_ptr<blink::WebLayer> web_layer_;
Fady Samueld5c26182017-07-12 02:43:3395 viz::SurfaceId surface_id_;
dcheng5cf543012016-11-24 17:13:3796 blink::WebRemoteFrame* frame_;
[email protected]0d25cb62013-01-21 15:42:2197
samans72b2a282016-12-17 02:44:1598 scoped_refptr<cc::SurfaceReferenceFactory> surface_reference_factory_;
99
[email protected]bffc8302014-01-23 20:52:16100 DISALLOW_COPY_AND_ASSIGN(ChildFrameCompositingHelper);
[email protected]0f21e8582013-01-11 11:06:56101};
102
103} // namespace content
104
[email protected]bffc8302014-01-23 20:52:16105#endif // CONTENT_RENDERER_CHILD_FRAME_COMPOSITING_HELPER_H_