Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: content/browser/gpu/gpu_process_host.h

Issue 7800015: prune down content_dll change to just the CONTENT_EXPORTS (Closed)
Patch Set: update copyright headers, merge Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 11
12 #include "base/callback_old.h" 12 #include "base/callback_old.h"
13 #include "base/memory/linked_ptr.h" 13 #include "base/memory/linked_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "content/browser/browser_child_process_host.h" 15 #include "content/browser/browser_child_process_host.h"
16 #include "content/common/content_export.h"
16 #include "content/common/gpu/gpu_info.h" 17 #include "content/common/gpu/gpu_info.h"
17 #include "content/common/gpu/gpu_process_launch_causes.h" 18 #include "content/common/gpu/gpu_process_launch_causes.h"
18 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
19 20
20 struct GPUCreateCommandBufferConfig; 21 struct GPUCreateCommandBufferConfig;
21 22
22 namespace IPC { 23 namespace IPC {
23 class Message; 24 class Message;
24 } 25 }
25 26
26 class GpuMainThread; 27 class GpuMainThread;
27 28
28 class GpuProcessHost : public BrowserChildProcessHost, 29 class GpuProcessHost : public BrowserChildProcessHost,
29 public base::NonThreadSafe { 30 public base::NonThreadSafe {
30 public: 31 public:
31 static bool gpu_enabled() { return gpu_enabled_; } 32 static bool gpu_enabled() { return gpu_enabled_; }
32 33
33 // Creates a new GpuProcessHost or gets one for a particular 34 // Creates a new GpuProcessHost or gets one for a particular
34 // renderer process, resulting in the launching of a GPU process if required. 35 // renderer process, resulting in the launching of a GPU process if required.
35 // Returns null on failure. It is not safe to store the pointer once control 36 // Returns null on failure. It is not safe to store the pointer once control
36 // has returned to the message loop as it can be destroyed. Instead store the 37 // has returned to the message loop as it can be destroyed. Instead store the
37 // associated GPU host ID. A renderer ID of zero means the browser process. 38 // associated GPU host ID. A renderer ID of zero means the browser process.
38 // This could return NULL if GPU access is not allowed (blacklisted). 39 // This could return NULL if GPU access is not allowed (blacklisted).
39 static GpuProcessHost* GetForRenderer(int renderer_id, 40 static GpuProcessHost* GetForRenderer(int renderer_id,
40 content::CauseForGpuLaunch cause); 41 content::CauseForGpuLaunch cause);
41 42
42 // Helper function to send the given message to the GPU process on the IO 43 // Helper function to send the given message to the GPU process on the IO
43 // thread. Calls GetForRenderer and if a host is returned, sends it. 44 // thread. Calls GetForRenderer and if a host is returned, sends it.
44 // Can be called from any thread. 45 // Can be called from any thread.
45 static void SendOnIO(int renderer_id, 46 CONTENT_EXPORT static void SendOnIO(int renderer_id,
46 content::CauseForGpuLaunch cause, 47 content::CauseForGpuLaunch cause,
47 IPC::Message* message); 48 IPC::Message* message);
48 49
49 // Get the GPU process host for the GPU process with the given ID. Returns 50 // Get the GPU process host for the GPU process with the given ID. Returns
50 // null if the process no longer exists. 51 // null if the process no longer exists.
51 static GpuProcessHost* FromID(int host_id); 52 static GpuProcessHost* FromID(int host_id);
52 int host_id() const { return host_id_; } 53 int host_id() const { return host_id_; }
53 54
54 virtual bool Send(IPC::Message* msg); 55 virtual bool Send(IPC::Message* msg);
55 56
56 // ChildProcessHost implementation. 57 // ChildProcessHost implementation.
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 147
147 // Whether we are running a GPU thread inside the browser process instead 148 // Whether we are running a GPU thread inside the browser process instead
148 // of a separate GPU process. 149 // of a separate GPU process.
149 bool in_process_; 150 bool in_process_;
150 151
151 scoped_ptr<GpuMainThread> in_process_gpu_thread_; 152 scoped_ptr<GpuMainThread> in_process_gpu_thread_;
152 153
153 // Master switch for enabling/disabling GPU acceleration for the current 154 // Master switch for enabling/disabling GPU acceleration for the current
154 // browser session. It does not change the acceleration settings for 155 // browser session. It does not change the acceleration settings for
155 // existing tabs, just the future ones. 156 // existing tabs, just the future ones.
156 static bool gpu_enabled_; 157 CONTENT_EXPORT static bool gpu_enabled_;
157 158
158 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost); 159 DISALLOW_COPY_AND_ASSIGN(GpuProcessHost);
159 }; 160 };
160 161
161 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_ 162 #endif // CONTENT_BROWSER_GPU_GPU_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698