Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / gpu_command_buffer_stub.h
index bf1914a..52cb5d7 100644 (file)
 #include "url/gurl.h"
 
 namespace gpu {
-class GpuControlService;
 struct Mailbox;
 namespace gles2 {
-class ImageManager;
 class MailboxManager;
 }
 }
@@ -44,7 +42,9 @@ namespace content {
 
 class GpuChannel;
 class GpuVideoDecodeAccelerator;
+class GpuVideoEncodeAccelerator;
 class GpuWatchdog;
+struct WaitForCommandState;
 
 class GpuCommandBufferStub
     : public GpuMemoryManagerClient,
@@ -61,7 +61,7 @@ class GpuCommandBufferStub
     virtual ~DestructionObserver() {}
   };
 
-  typedef base::Callback<void(const ui::LatencyInfo&)>
+  typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)>
       LatencyInfoCallback;
 
   GpuCommandBufferStub(
@@ -69,7 +69,6 @@ class GpuCommandBufferStub
       GpuCommandBufferStub* share_group,
       const gfx::GLSurfaceHandle& handle,
       gpu::gles2::MailboxManager* mailbox_manager,
-      gpu::gles2::ImageManager* image_manager,
       const gfx::Size& size,
       const gpu::gles2::DisallowedFeatures& disallowed_features,
       const std::vector<int32>& attribs,
@@ -121,6 +120,8 @@ class GpuCommandBufferStub
 
   gfx::GpuPreference gpu_preference() { return gpu_preference_; }
 
+  int32 GetRequestedAttribute(int attr) const;
+
   // Sends a message to the console.
   void SendConsoleMessage(int32 id, const std::string& message);
 
@@ -141,8 +142,10 @@ class GpuCommandBufferStub
 
   void MarkContextLost();
 
+  uint64 GetMemoryUsage() const;
+
  private:
-  GpuMemoryManager* GetMemoryManager();
+  GpuMemoryManager* GetMemoryManager() const;
   bool MakeCurrent();
   void Destroy();
 
@@ -155,7 +158,12 @@ class GpuCommandBufferStub
   void OnSetGetBuffer(int32 shm_id, IPC::Message* reply_message);
   void OnProduceFrontBuffer(const gpu::Mailbox& mailbox);
   void OnGetState(IPC::Message* reply_message);
-  void OnGetStateFast(IPC::Message* reply_message);
+  void OnWaitForTokenInRange(int32 start,
+                             int32 end,
+                             IPC::Message* reply_message);
+  void OnWaitForGetOffsetInRange(int32 start,
+                                 int32 end,
+                                 IPC::Message* reply_message);
   void OnAsyncFlush(int32 put_offset, uint32 flush_count);
   void OnEcho(const IPC::Message& message);
   void OnRescheduled();
@@ -165,13 +173,18 @@ class GpuCommandBufferStub
   void OnDestroyTransferBuffer(int32 id);
   void OnGetTransferBuffer(int32 id, IPC::Message* reply_message);
 
-  void OnCreateVideoDecoder(
-      media::VideoCodecProfile profile,
-      IPC::Message* reply_message);
+  void OnCreateVideoDecoder(media::VideoCodecProfile profile,
+                            int32 route_id,
+                            IPC::Message* reply_message);
+  void OnCreateVideoEncoder(media::VideoFrame::Format input_format,
+                            const gfx::Size& input_visible_size,
+                            media::VideoCodecProfile output_profile,
+                            uint32 initial_bitrate,
+                            int32 route_id,
+                            IPC::Message* reply_message);
 
   void OnSetSurfaceVisible(bool visible);
 
-  void OnDiscardBackbuffer();
   void OnEnsureBackbuffer();
 
   void OnRetireSyncPoint(uint32 sync_point);
@@ -181,19 +194,20 @@ class GpuCommandBufferStub
   void OnSignalSyncPointAck(uint32 id);
   void OnSignalQuery(uint32 query, uint32 id);
 
-  void OnReceivedClientManagedMemoryStats(const gpu::ManagedMemoryStats& stats);
   void OnSetClientHasMemoryAllocationChangedCallback(bool has_callback);
 
   void OnRegisterGpuMemoryBuffer(int32 id,
-                                 gfx::GpuMemoryBufferHandle gpu_memory_buffer,
+                                 gfx::GpuMemoryBufferHandle handle,
                                  uint32 width,
                                  uint32 height,
                                  uint32 internalformat);
-  void OnDestroyGpuMemoryBuffer(int32 id);
+  void OnUnregisterGpuMemoryBuffer(int32 id);
 
   void OnCommandProcessed();
   void OnParseError();
-  void OnSetLatencyInfo(const ui::LatencyInfo& latency_info);
+  void OnSetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info);
+  void OnCreateStreamTexture(
+      uint32 texture_id, int32 stream_id, bool* succeeded);
 
   void ReportState();
 
@@ -209,6 +223,7 @@ class GpuCommandBufferStub
   void ScheduleDelayedWork(int64 delay);
 
   bool CheckContextLost();
+  void CheckCompleteWaits();
 
   // The lifetime of objects of this class is managed by a GpuChannel. The
   // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
@@ -233,7 +248,6 @@ class GpuCommandBufferStub
   scoped_ptr<gpu::gles2::GLES2Decoder> decoder_;
   scoped_ptr<gpu::GpuScheduler> scheduler_;
   scoped_refptr<gfx::GLSurface> surface_;
-  scoped_ptr<gpu::GpuControlService> gpu_control_;
 
   scoped_ptr<GpuMemoryManagerClientState> memory_manager_client_state_;
   // The last memory allocation received from the GpuMemoryManager (used to
@@ -261,6 +275,8 @@ class GpuCommandBufferStub
   size_t active_url_hash_;
 
   size_t total_gpu_memory_;
+  scoped_ptr<WaitForCommandState> wait_for_token_;
+  scoped_ptr<WaitForCommandState> wait_for_get_offset_;
 
   DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
 };