OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 // This class lives on the UI thread and supports classes like the | 8 // This class lives on the UI thread and supports classes like the |
9 // BackingStoreProxy, which must live on the UI thread. The IO thread | 9 // BackingStoreProxy, which must live on the UI thread. The IO thread |
10 // portion of this class, the GpuProcessHost, is responsible for | 10 // portion of this class, the GpuProcessHost, is responsible for |
11 // shuttling messages between the browser and GPU processes. | 11 // shuttling messages between the browser and GPU processes. |
12 | 12 |
13 #include <stdint.h> | 13 #include <stdint.h> |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
21 #include "base/threading/non_thread_safe.h" | 21 #include "base/threading/non_thread_safe.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "content/public/common/gpu_memory_stats.h" | 24 #include "content/public/common/gpu_memory_stats.h" |
25 #include "gpu/config/gpu_info.h" | 25 #include "gpu/config/gpu_info.h" |
26 #include "ipc/ipc_listener.h" | 26 #include "ipc/ipc_listener.h" |
27 #include "ipc/ipc_sender.h" | 27 #include "ipc/ipc_sender.h" |
28 #include "ipc/message_router.h" | 28 #include "ipc/message_router.h" |
29 | 29 |
30 #if defined(OS_MACOSX) | |
31 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | |
32 #endif | |
33 | |
34 namespace ui { | 30 namespace ui { |
35 class LatencyInfo; | 31 class LatencyInfo; |
36 } | 32 } |
37 | 33 |
38 namespace gfx { | 34 namespace gfx { |
39 class Size; | 35 class Size; |
40 } | 36 } |
41 | 37 |
42 namespace IPC { | 38 namespace IPC { |
43 class Message; | 39 class Message; |
44 } | 40 } |
45 | 41 |
46 namespace content { | 42 namespace content { |
| 43 #if defined(OS_MACOSX) |
| 44 struct AcceleratedSurfaceBuffersSwappedParams; |
| 45 #endif |
47 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); | 46 void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg); |
48 | 47 |
49 class GpuProcessHostUIShim : public IPC::Listener, | 48 class GpuProcessHostUIShim : public IPC::Listener, |
50 public IPC::Sender, | 49 public IPC::Sender, |
51 public base::NonThreadSafe { | 50 public base::NonThreadSafe { |
52 public: | 51 public: |
53 // Create a GpuProcessHostUIShim with the given ID. The object can be found | 52 // Create a GpuProcessHostUIShim with the given ID. The object can be found |
54 // using FromID with the same id. | 53 // using FromID with the same id. |
55 static GpuProcessHostUIShim* Create(int host_id); | 54 static GpuProcessHostUIShim* Create(int host_id); |
56 | 55 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Message handlers. | 90 // Message handlers. |
92 bool OnControlMessageReceived(const IPC::Message& message); | 91 bool OnControlMessageReceived(const IPC::Message& message); |
93 | 92 |
94 void OnLogMessage(int level, const std::string& header, | 93 void OnLogMessage(int level, const std::string& header, |
95 const std::string& message); | 94 const std::string& message); |
96 | 95 |
97 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); | 96 void OnGraphicsInfoCollected(const gpu::GPUInfo& gpu_info); |
98 | 97 |
99 #if defined(OS_MACOSX) | 98 #if defined(OS_MACOSX) |
100 void OnAcceleratedSurfaceBuffersSwapped( | 99 void OnAcceleratedSurfaceBuffersSwapped( |
101 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params); | 100 const AcceleratedSurfaceBuffersSwappedParams& params); |
102 #endif | 101 #endif |
103 void OnVideoMemoryUsageStatsReceived( | 102 void OnVideoMemoryUsageStatsReceived( |
104 const GPUVideoMemoryUsageStats& video_memory_usage_stats); | 103 const GPUVideoMemoryUsageStats& video_memory_usage_stats); |
105 void OnAddSubscription(int32_t process_id, unsigned int target); | 104 void OnAddSubscription(int32_t process_id, unsigned int target); |
106 void OnRemoveSubscription(int32_t process_id, unsigned int target); | 105 void OnRemoveSubscription(int32_t process_id, unsigned int target); |
107 | 106 |
108 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. | 107 // The serial number of the GpuProcessHost / GpuProcessHostUIShim pair. |
109 int host_id_; | 108 int host_id_; |
110 base::Closure close_callback_; | 109 base::Closure close_callback_; |
111 }; | 110 }; |
112 | 111 |
113 } // namespace content | 112 } // namespace content |
114 | 113 |
115 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ | 114 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_UI_SHIM_H_ |
OLD | NEW |