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_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // This class lives on the UI thread and supports classes like the | 9 // This class lives on the UI thread and supports classes like the |
10 // BackingStoreProxy, which must live on the UI thread. The IO thread | 10 // BackingStoreProxy, which must live on the UI thread. The IO thread |
(...skipping 22 matching lines...) Expand all Loading... |
33 class Message; | 33 class Message; |
34 } | 34 } |
35 | 35 |
36 // A task that will forward an IPC message to the UI shim. | 36 // A task that will forward an IPC message to the UI shim. |
37 class RouteToGpuProcessHostUIShimTask : public Task { | 37 class RouteToGpuProcessHostUIShimTask : public Task { |
38 public: | 38 public: |
39 RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | 39 RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); |
40 virtual ~RouteToGpuProcessHostUIShimTask(); | 40 virtual ~RouteToGpuProcessHostUIShimTask(); |
41 | 41 |
42 private: | 42 private: |
43 virtual void Run(); | 43 virtual void Run() OVERRIDE; |
44 | 44 |
45 int host_id_; | 45 int host_id_; |
46 IPC::Message msg_; | 46 IPC::Message msg_; |
47 }; | 47 }; |
48 | 48 |
49 class GpuProcessHostUIShim | 49 class GpuProcessHostUIShim |
50 : public IPC::Channel::Listener, | 50 : public IPC::Channel::Listener, |
51 public IPC::Channel::Sender, | 51 public IPC::Channel::Sender, |
52 public base::NonThreadSafe { | 52 public base::NonThreadSafe { |
53 public: | 53 public: |
54 // Create a GpuProcessHostUIShim with the given ID. The object can be found | 54 // Create a GpuProcessHostUIShim with the given ID. The object can be found |
55 // using FromID with the same id. | 55 // using FromID with the same id. |
56 static GpuProcessHostUIShim* Create(int host_id); | 56 static GpuProcessHostUIShim* Create(int host_id); |
57 | 57 |
58 // Destroy the GpuProcessHostUIShim with the given host ID. This can only | 58 // Destroy the GpuProcessHostUIShim with the given host ID. This can only |
59 // be called on the UI thread. Only the GpuProcessHost should destroy the | 59 // be called on the UI thread. Only the GpuProcessHost should destroy the |
60 // UI shim. | 60 // UI shim. |
61 static void Destroy(int host_id); | 61 static void Destroy(int host_id); |
62 | 62 |
63 // Destroy all remaining GpuProcessHostUIShims. | 63 // Destroy all remaining GpuProcessHostUIShims. |
64 CONTENT_EXPORT static void DestroyAll(); | 64 CONTENT_EXPORT static void DestroyAll(); |
65 | 65 |
66 static GpuProcessHostUIShim* FromID(int host_id); | 66 static GpuProcessHostUIShim* FromID(int host_id); |
67 | 67 |
68 // IPC::Channel::Sender implementation. | 68 // IPC::Channel::Sender implementation. |
69 virtual bool Send(IPC::Message* msg); | 69 virtual bool Send(IPC::Message* msg) OVERRIDE; |
70 | 70 |
71 // IPC::Channel::Listener implementation. | 71 // IPC::Channel::Listener implementation. |
72 // The GpuProcessHost causes this to be called on the UI thread to | 72 // The GpuProcessHost causes this to be called on the UI thread to |
73 // dispatch the incoming messages from the GPU process, which are | 73 // dispatch the incoming messages from the GPU process, which are |
74 // actually received on the IO thread. | 74 // actually received on the IO thread. |
75 virtual bool OnMessageReceived(const IPC::Message& message); | 75 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
76 | 76 |
77 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 77 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
78 // TODO(apatrick): Remove this when mac does not use AcceleratedSurfaces for | 78 // TODO(apatrick): Remove this when mac does not use AcceleratedSurfaces for |
79 // when running the GPU thread in the browser process. | 79 // when running the GPU thread in the browser process. |
80 // This is now also used in TOUCH_UI builds. | 80 // This is now also used in TOUCH_UI builds. |
81 static void SendToGpuHost(int host_id, IPC::Message* msg); | 81 static void SendToGpuHost(int host_id, IPC::Message* msg); |
82 #endif | 82 #endif |
83 | 83 |
84 private: | 84 private: |
85 explicit GpuProcessHostUIShim(int host_id); | 85 explicit GpuProcessHostUIShim(int host_id); |
(...skipping 22 matching lines...) Expand all Loading... |
108 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 108 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
109 void OnAcceleratedSurfaceRelease( | 109 void OnAcceleratedSurfaceRelease( |
110 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params); | 110 const GpuHostMsg_AcceleratedSurfaceRelease_Params& params); |
111 #endif | 111 #endif |
112 | 112 |
113 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 113 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
114 int host_id_; | 114 int host_id_; |
115 }; | 115 }; |
116 | 116 |
117 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 117 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
OLD | NEW |