Home | History | Annotate | Download | only in pepper
      1 // Copyright (c) 2013 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 CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
      6 #define CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "ppapi/c/pp_instance.h"
     11 #include "ppapi/host/instance_message_filter.h"
     12 
     13 namespace content {
     14 class RendererPpapiHost;
     15 }
     16 
     17 namespace ppapi {
     18 namespace proxy {
     19 class SerializedHandle;
     20 }
     21 }
     22 
     23 // Implements the backend for shared memory messages from a plugin process.
     24 class PepperSharedMemoryMessageFilter
     25     : public ppapi::host::InstanceMessageFilter {
     26  public:
     27   explicit PepperSharedMemoryMessageFilter(content::RendererPpapiHost* host);
     28   virtual ~PepperSharedMemoryMessageFilter();
     29 
     30   // InstanceMessageFilter:
     31   virtual bool OnInstanceMessageReceived(const IPC::Message& msg) OVERRIDE;
     32 
     33   bool Send(IPC::Message* msg);
     34 
     35  private:
     36   // Message handlers.
     37   void OnHostMsgCreateSharedMemory(
     38       PP_Instance instance,
     39       uint32_t size,
     40       int* host_shm_handle_id,
     41       ppapi::proxy::SerializedHandle* plugin_shm_handle);
     42 
     43   content::RendererPpapiHost* host_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(PepperSharedMemoryMessageFilter);
     46 };
     47 
     48 #endif  // CHROME_RENDERER_PEPPER_PEPPER_SHARED_MEMORY_MESSAGE_FILTER_H_
     49