| 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 <string> | 10 #include <string> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Creates a new GpuProcessHost or gets an existing one, resulting in the | 54 // Creates a new GpuProcessHost or gets an existing one, resulting in the |
| 55 // launching of a GPU process if required. Returns null on failure. It | 55 // launching of a GPU process if required. Returns null on failure. It |
| 56 // is not safe to store the pointer once control has returned to the message | 56 // is not safe to store the pointer once control has returned to the message |
| 57 // loop as it can be destroyed. Instead store the associated GPU host ID. | 57 // loop as it can be destroyed. Instead store the associated GPU host ID. |
| 58 // This could return NULL if GPU access is not allowed (blacklisted). | 58 // This could return NULL if GPU access is not allowed (blacklisted). |
| 59 static GpuProcessHost* Get(GpuProcessKind kind, | 59 static GpuProcessHost* Get(GpuProcessKind kind, |
| 60 content::CauseForGpuLaunch cause); | 60 content::CauseForGpuLaunch cause); |
| 61 | 61 |
| 62 // Helper function to send the given message to the GPU process on the IO | 62 // Helper function to send the given message to the GPU process on the IO |
| 63 // thread. Calls Get and if a host is returned, sends it. Can be called from | 63 // thread. Calls Get and if a host is returned, sends it. Can be called from |
| 64 // any thread. | 64 // any thread. Deletes the message if it cannot be sent. |
| 65 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, | 65 CONTENT_EXPORT static void SendOnIO(GpuProcessKind kind, |
| 66 content::CauseForGpuLaunch cause, | 66 content::CauseForGpuLaunch cause, |
| 67 IPC::Message* message); | 67 IPC::Message* message); |
| 68 | 68 |
| 69 // Get the GPU process host for the GPU process with the given ID. Returns | 69 // Get the GPU process host for the GPU process with the given ID. Returns |
| 70 // null if the process no longer exists. | 70 // null if the process no longer exists. |
| 71 static GpuProcessHost* FromID(int host_id); | 71 static GpuProcessHost* FromID(int host_id); |
| 72 int host_id() const { return host_id_; } | 72 int host_id() const { return host_id_; } |
| 73 | 73 |
| 74 // IPC::Sender implementation. | 74 // IPC::Sender implementation. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 static bool gpu_enabled_; | 195 static bool gpu_enabled_; |
| 196 | 196 |
| 197 static bool hardware_gpu_enabled_; | 197 static bool hardware_gpu_enabled_; |
| 198 | 198 |
| 199 scoped_ptr<BrowserChildProcessHostImpl> process_; | 199 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 200 | 200 |
| 201 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); | 201 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ | 204 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ |
| OLD | NEW |