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_H_ | 5 #ifndef CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( | 89 CONTENT_EXPORT static void RegisterGpuMainThreadFactory( |
90 GpuMainThreadFactoryFunction create); | 90 GpuMainThreadFactoryFunction create); |
91 | 91 |
92 // Get the GPU process host for the GPU process with the given ID. Returns | 92 // Get the GPU process host for the GPU process with the given ID. Returns |
93 // null if the process no longer exists. | 93 // null if the process no longer exists. |
94 static GpuProcessHost* FromID(int host_id); | 94 static GpuProcessHost* FromID(int host_id); |
95 int host_id() const { return host_id_; } | 95 int host_id() const { return host_id_; } |
96 | 96 |
97 // IPC::Sender implementation. | 97 // IPC::Sender implementation. |
98 virtual bool Send(IPC::Message* msg) override; | 98 bool Send(IPC::Message* msg) override; |
99 | 99 |
100 // Adds a message filter to the GpuProcessHost's channel. | 100 // Adds a message filter to the GpuProcessHost's channel. |
101 void AddFilter(IPC::MessageFilter* filter); | 101 void AddFilter(IPC::MessageFilter* filter); |
102 | 102 |
103 // Tells the GPU process to create a new channel for communication with a | 103 // Tells the GPU process to create a new channel for communication with a |
104 // client. Once the GPU process responds asynchronously with the IPC handle | 104 // client. Once the GPU process responds asynchronously with the IPC handle |
105 // and GPUInfo, we call the callback. | 105 // and GPUInfo, we call the callback. |
106 void EstablishGpuChannel(int client_id, | 106 void EstablishGpuChannel(int client_id, |
107 bool share_context, | 107 bool share_context, |
108 bool allow_future_sync_points, | 108 bool allow_future_sync_points, |
(...skipping 29 matching lines...) Expand all Loading... |
138 void BeginFrameSubscription( | 138 void BeginFrameSubscription( |
139 int surface_id, | 139 int surface_id, |
140 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); | 140 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber); |
141 void EndFrameSubscription(int surface_id); | 141 void EndFrameSubscription(int surface_id); |
142 void LoadedShader(const std::string& key, const std::string& data); | 142 void LoadedShader(const std::string& key, const std::string& data); |
143 | 143 |
144 private: | 144 private: |
145 static bool ValidateHost(GpuProcessHost* host); | 145 static bool ValidateHost(GpuProcessHost* host); |
146 | 146 |
147 GpuProcessHost(int host_id, GpuProcessKind kind); | 147 GpuProcessHost(int host_id, GpuProcessKind kind); |
148 virtual ~GpuProcessHost(); | 148 ~GpuProcessHost() override; |
149 | 149 |
150 bool Init(); | 150 bool Init(); |
151 | 151 |
152 // Post an IPC message to the UI shim's message handler on the UI thread. | 152 // Post an IPC message to the UI shim's message handler on the UI thread. |
153 void RouteOnUIThread(const IPC::Message& message); | 153 void RouteOnUIThread(const IPC::Message& message); |
154 | 154 |
155 // BrowserChildProcessHostDelegate implementation. | 155 // BrowserChildProcessHostDelegate implementation. |
156 virtual bool OnMessageReceived(const IPC::Message& message) override; | 156 bool OnMessageReceived(const IPC::Message& message) override; |
157 virtual void OnChannelConnected(int32 peer_pid) override; | 157 void OnChannelConnected(int32 peer_pid) override; |
158 virtual void OnProcessLaunched() override; | 158 void OnProcessLaunched() override; |
159 virtual void OnProcessCrashed(int exit_code) override; | 159 void OnProcessCrashed(int exit_code) override; |
160 | 160 |
161 // Message handlers. | 161 // Message handlers. |
162 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); | 162 void OnInitialized(bool result, const gpu::GPUInfo& gpu_info); |
163 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); | 163 void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); |
164 void OnCommandBufferCreated(CreateCommandBufferResult result); | 164 void OnCommandBufferCreated(CreateCommandBufferResult result); |
165 void OnDestroyCommandBuffer(int32 surface_id); | 165 void OnDestroyCommandBuffer(int32 surface_id); |
166 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); | 166 void OnGpuMemoryBufferCreated(const gfx::GpuMemoryBufferHandle& handle); |
167 void OnDidCreateOffscreenContext(const GURL& url); | 167 void OnDidCreateOffscreenContext(const GURL& url); |
168 void OnDidLoseContext(bool offscreen, | 168 void OnDidLoseContext(bool offscreen, |
169 gpu::error::ContextLostReason reason, | 169 gpu::error::ContextLostReason reason, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > | 274 typedef std::multimap<int, scoped_refptr<GpuSurfaceTracker::SurfaceRef> > |
275 SurfaceRefMap; | 275 SurfaceRefMap; |
276 SurfaceRefMap surface_refs_; | 276 SurfaceRefMap surface_refs_; |
277 | 277 |
278 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 278 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
279 }; | 279 }; |
280 | 280 |
281 } // namespace content | 281 } // namespace content |
282 | 282 |
283 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 283 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
OLD | NEW |