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

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: Update 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/shared_memory.h"
11 #include "base/memory/weak_ptr.h"
12 #include "cc/layers/solid_color_layer.h"
13 #include "ppapi/host/host_message_context.h"
14 #include "ppapi/host/resource_host.h"
15 #include "ppapi/shared_impl/compositor_layer.h"
16
17 namespace content {
18
19 class PepperPluginInstanceImpl;
20 class RendererPpapiHost;
21
22 class PepperCompositorHost : public ppapi::host::ResourceHost {
23 public:
24 PepperCompositorHost(RendererPpapiHost* host,
25 PP_Instance instance,
26 PP_Resource resource);
27 // Assciates this device with the given plugin instance. You can pass NULL
raymes 2014/06/02 03:51:08 Associates
Peng 2014/06/02 19:01:55 Done.
28 // to clear the existing device. Returns true on success. In this case, a
29 // repaint of the page will also be scheduled. Failure means that the device
30 // is already bound to a different instance, and nothing will happen.
31 bool BindToInstance(PepperPluginInstanceImpl* new_instance);
32
33 const scoped_refptr<cc::Layer> layer() { return layer_; };
34
35 void ViewInitiatedPaint();
36 void ViewFlushedPaint();
37
38 private:
39 virtual ~PepperCompositorHost();
40
41 void UpdateLayer(const scoped_refptr<cc::Layer>& layer,
42 ppapi::CompositorLayer* pp_layer_old,
43 const ppapi::CompositorLayer* pp_layer);
44
45 void ResourceReleased(int32_t id,
46 uint32_t sync_point,
47 bool is_lost);
48 void ImageReleased(int32_t id,
49 scoped_ptr<base::SharedMemory> shared_memory,
50 uint32_t sync_point,
51 bool is_lost);
52
53 // ResourceMessageHandler overrides:
54 virtual int32_t OnResourceMessageReceived(
55 const IPC::Message& msg,
56 ppapi::host::HostMessageContext* context) OVERRIDE;
57
58 // ppapi::host::ResourceHost overrides:
59 virtual bool IsCompositorHost() OVERRIDE;
60
61 // Message handlers:
62 int32_t OnHostMsgCommitLayers(
63 ppapi::host::HostMessageContext* context,
64 const std::vector<ppapi::CompositorLayer>& layers,
65 bool changed);
66
67 // Non-owning pointer to the plugin instance this context is currently bound
68 // to, if any. If the context is currently unbound, this will be NULL.
69 PepperPluginInstanceImpl* bound_instance_;
70
71 scoped_refptr<cc::Layer> layer_;
72 std::vector<scoped_refptr<cc::Layer> > cc_layers_;
73 std::vector<ppapi::CompositorLayer> pp_layers_;
raymes 2014/06/02 03:51:08 Some comments for these members would be useful fo
Peng 2014/06/02 19:01:55 Done.
74
75 ppapi::host::ReplyMessageContext commit_layers_reply_context_;
76
77 base::WeakPtrFactory<PepperCompositorHost> weak_factory_;
78
79 DISALLOW_COPY_AND_ASSIGN(PepperCompositorHost);
80 };
81
82 } // namespace content
83
84 #endif // CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698