| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ |
| 6 #define CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ | 6 #define CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include "base/memory/weak_ptr.h" |
| 11 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
| 12 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 13 | 14 |
| 14 namespace gfx { | 15 namespace gfx { |
| 15 class Size; | 16 class Size; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // Client side proxy that forwards messages to a GpuSurfaceStub. | 19 // Client side proxy that forwards messages to a GpuSurfaceStub. |
| 19 class GpuSurfaceProxy : public IPC::Channel::Listener { | 20 class GpuSurfaceProxy : public IPC::Channel::Listener, |
| 21 public base::SupportsWeakPtr<GpuSurfaceProxy> { |
| 20 public: | 22 public: |
| 21 GpuSurfaceProxy(IPC::Channel::Sender* channel, int route_id); | 23 GpuSurfaceProxy(IPC::Channel::Sender* channel, int route_id); |
| 22 virtual ~GpuSurfaceProxy(); | 24 virtual ~GpuSurfaceProxy(); |
| 23 | 25 |
| 24 // IPC::Channel::Listener implementation: | 26 // IPC::Channel::Listener implementation: |
| 25 virtual bool OnMessageReceived(const IPC::Message& message); | 27 virtual bool OnMessageReceived(const IPC::Message& message); |
| 26 virtual void OnChannelError(); | 28 virtual void OnChannelError(); |
| 27 | 29 |
| 28 int route_id() const { return route_id_; } | 30 int route_id() const { return route_id_; } |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 | 33 |
| 32 // Send an IPC message over the GPU channel. This is private to fully | 34 // Send an IPC message over the GPU channel. This is private to fully |
| 33 // encapsulate the channel; all callers of this function must explicitly | 35 // encapsulate the channel; all callers of this function must explicitly |
| 34 // verify that the channel is still available. | 36 // verify that the channel is still available. |
| 35 bool Send(IPC::Message* msg); | 37 bool Send(IPC::Message* msg); |
| 36 | 38 |
| 37 IPC::Channel::Sender* channel_; | 39 IPC::Channel::Sender* channel_; |
| 38 int route_id_; | 40 int route_id_; |
| 39 | 41 |
| 40 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceProxy); | 42 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceProxy); |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 #endif // ENABLE_GPU | 45 #endif // ENABLE_GPU |
| 44 | 46 |
| 45 #endif // CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ | 47 #endif // CONTENT_RENDERER_GPU_GPU_SURFACE_PROXY_H_ |
| OLD | NEW |