Chromium Code Reviews| Index: content/renderer/pepper/pepper_compositor_host.h |
| diff --git a/content/renderer/pepper/pepper_compositor_host.h b/content/renderer/pepper/pepper_compositor_host.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f2cfc8aec7d8ff6f4c4ba2e2303f857ebc88b8f9 |
| --- /dev/null |
| +++ b/content/renderer/pepper/pepper_compositor_host.h |
| @@ -0,0 +1,84 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_ |
| +#define CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_ |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/memory/shared_memory.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "cc/layers/solid_color_layer.h" |
| +#include "ppapi/host/host_message_context.h" |
| +#include "ppapi/host/resource_host.h" |
| +#include "ppapi/shared_impl/compositor_layer.h" |
| + |
| +namespace content { |
| + |
| +class PepperPluginInstanceImpl; |
| +class RendererPpapiHost; |
| + |
| +class PepperCompositorHost : public ppapi::host::ResourceHost { |
| + public: |
| + PepperCompositorHost(RendererPpapiHost* host, |
| + PP_Instance instance, |
| + PP_Resource resource); |
| + // 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.
|
| + // to clear the existing device. Returns true on success. In this case, a |
| + // repaint of the page will also be scheduled. Failure means that the device |
| + // is already bound to a different instance, and nothing will happen. |
| + bool BindToInstance(PepperPluginInstanceImpl* new_instance); |
| + |
| + const scoped_refptr<cc::Layer> layer() { return layer_; }; |
| + |
| + void ViewInitiatedPaint(); |
| + void ViewFlushedPaint(); |
| + |
| + private: |
| + virtual ~PepperCompositorHost(); |
| + |
| + void UpdateLayer(const scoped_refptr<cc::Layer>& layer, |
| + ppapi::CompositorLayer* pp_layer_old, |
| + const ppapi::CompositorLayer* pp_layer); |
| + |
| + void ResourceReleased(int32_t id, |
| + uint32_t sync_point, |
| + bool is_lost); |
| + void ImageReleased(int32_t id, |
| + scoped_ptr<base::SharedMemory> shared_memory, |
| + uint32_t sync_point, |
| + bool is_lost); |
| + |
| + // ResourceMessageHandler overrides: |
| + virtual int32_t OnResourceMessageReceived( |
| + const IPC::Message& msg, |
| + ppapi::host::HostMessageContext* context) OVERRIDE; |
| + |
| + // ppapi::host::ResourceHost overrides: |
| + virtual bool IsCompositorHost() OVERRIDE; |
| + |
| + // Message handlers: |
| + int32_t OnHostMsgCommitLayers( |
| + ppapi::host::HostMessageContext* context, |
| + const std::vector<ppapi::CompositorLayer>& layers, |
| + bool changed); |
| + |
| + // Non-owning pointer to the plugin instance this context is currently bound |
| + // to, if any. If the context is currently unbound, this will be NULL. |
| + PepperPluginInstanceImpl* bound_instance_; |
| + |
| + scoped_refptr<cc::Layer> layer_; |
| + std::vector<scoped_refptr<cc::Layer> > cc_layers_; |
| + 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.
|
| + |
| + ppapi::host::ReplyMessageContext commit_layers_reply_context_; |
| + |
| + base::WeakPtrFactory<PepperCompositorHost> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PepperCompositorHost); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_PEPPER_PEPPER_COMPOSITOR_H_ |