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

Side by Side Diff: content/renderer/pepper/pepper_compositor_host.h

Issue 298023004: [PPAPI] Compositor API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor_api_def_new
Patch Set: Use a clip parent for clip_rect Created 6 years, 6 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
(Empty)
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.
4
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "ppapi/host/host_message_context.h"
12 #include "ppapi/host/resource_host.h"
13 #include "ppapi/shared_impl/compositor_layer_data.h"
14
15 namespace base {
16 class SharedMemory;
17 } // namespace base
18
19 namespace cc {
20 class Layer;
21 } // namespace cc
22
23 namespace content {
24
25 class PepperPluginInstanceImpl;
26 class RendererPpapiHost;
27
28 class PepperCompositorHost : public ppapi::host::ResourceHost {
29 public:
30 PepperCompositorHost(RendererPpapiHost* host,
31 PP_Instance instance,
32 PP_Resource resource);
33 // Associates this device with the given plugin instance. You can pass NULL
34 // to clear the existing device. Returns true on success. In this case, a
35 // repaint of the page will also be scheduled. Failure means that the device
36 // is already bound to a different instance, and nothing will happen.
37 bool BindToInstance(PepperPluginInstanceImpl* new_instance);
38
39 const scoped_refptr<cc::Layer> layer() { return layer_; };
40
41 void ViewInitiatedPaint();
42 void ViewFlushedPaint();
43
44 private:
45 virtual ~PepperCompositorHost();
46
47 int32_t VerifyCommittedLayers(
48 const std::vector<ppapi::CompositorLayerData>& layers,
49 bool reset);
50
51 void UpdateLayer(const scoped_refptr<cc::Layer>& layer,
52 const ppapi::CompositorLayerData* pp_layer_old,
53 const ppapi::CompositorLayerData* pp_layer);
54
55 void ResourceReleased(int32_t id,
56 uint32_t sync_point,
57 bool is_lost);
58 void ImageReleased(int32_t id,
59 const scoped_ptr<base::SharedMemory>& shared_memory,
60 uint32_t sync_point,
61 bool is_lost);
62
63 // ResourceMessageHandler overrides:
64 virtual int32_t OnResourceMessageReceived(
65 const IPC::Message& msg,
66 ppapi::host::HostMessageContext* context) OVERRIDE;
67
68 // ppapi::host::ResourceHost overrides:
69 virtual bool IsCompositorHost() OVERRIDE;
70
71 // Message handlers:
72 int32_t OnHostMsgCommitLayers(
73 ppapi::host::HostMessageContext* context,
74 const std::vector<ppapi::CompositorLayerData>& layers,
75 bool reset);
76
77 // Non-owning pointer to the plugin instance this context is currently bound
78 // to, if any. If the context is currently unbound, this will be NULL.
79 PepperPluginInstanceImpl* bound_instance_;
80
81 // The toplevel cc::Layer. It is the parent of other cc::Layers.
82 scoped_refptr<cc::Layer> layer_;
83
84 // A list of layers. It is used for updating layers' properties in
85 // subsequent CommitLayers() calls.
86 struct LayerData {
87 LayerData(const scoped_refptr<cc::Layer>& cc,
88 const ppapi::CompositorLayerData& pp)
89 : cc_layer(cc), pp_layer(pp) {}
90 scoped_refptr<cc::Layer> cc_layer;
91 ppapi::CompositorLayerData pp_layer;
92 };
93 std::vector<LayerData> layers_;
94
95 ppapi::host::ReplyMessageContext commit_layers_reply_context_;
96
97 base::WeakPtrFactory<PepperCompositorHost> weak_factory_;
98
99 DISALLOW_COPY_AND_ASSIGN(PepperCompositorHost);
100 };
101
102 } // namespace content
103
104 #endif // CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698