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

Side by Side Diff: content/gpu/gpu_child_thread.h

Issue 1730023004: Revert of Decouple browser-specific GPU IPC messages from GPU service IPCs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « content/content_common.gypi ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_GPU_GPU_CHILD_THREAD_H_ 5 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_
6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/child/child_thread_impl.h" 19 #include "content/child/child_thread_impl.h"
20 #include "content/common/gpu/gpu_channel.h" 20 #include "content/common/gpu/gpu_channel.h"
21 #include "content/common/gpu/gpu_channel_manager.h" 21 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_channel_manager_delegate.h"
23 #include "content/common/gpu/gpu_config.h" 22 #include "content/common/gpu/gpu_config.h"
24 #include "content/common/gpu/x_util.h" 23 #include "content/common/gpu/x_util.h"
25 #include "content/common/process_control.mojom.h" 24 #include "content/common/process_control.mojom.h"
26 #include "gpu/config/gpu_info.h" 25 #include "gpu/config/gpu_info.h"
27 #include "mojo/public/cpp/bindings/interface_request.h" 26 #include "mojo/public/cpp/bindings/interface_request.h"
28 #include "mojo/public/cpp/bindings/weak_binding_set.h" 27 #include "mojo/public/cpp/bindings/weak_binding_set.h"
29 #include "ui/gfx/native_widget_types.h" 28 #include "ui/gfx/native_widget_types.h"
30 29
31 namespace gpu { 30 namespace gpu {
32 class SyncPointManager; 31 class SyncPointManager;
33 } 32 }
34 33
35 namespace sandbox { 34 namespace sandbox {
36 class TargetServices; 35 class TargetServices;
37 } 36 }
38 37
39 namespace content { 38 namespace content {
40 class GpuMemoryBufferFactory; 39 class GpuMemoryBufferFactory;
41 class GpuProcessControlImpl; 40 class GpuProcessControlImpl;
42 class GpuWatchdogThread; 41 class GpuWatchdogThread;
43 42
44 // The main thread of the GPU child process. There will only ever be one of 43 // The main thread of the GPU child process. There will only ever be one of
45 // these per process. It does process initialization and shutdown. It forwards 44 // these per process. It does process initialization and shutdown. It forwards
46 // IPC messages to GpuChannelManager, which is responsible for issuing rendering 45 // IPC messages to GpuChannelManager, which is responsible for issuing rendering
47 // commands to the GPU. 46 // commands to the GPU.
48 class GpuChildThread : public ChildThreadImpl, 47 class GpuChildThread : public ChildThreadImpl {
49 public GpuChannelManagerDelegate {
50 public: 48 public:
51 typedef std::queue<IPC::Message*> DeferredMessages; 49 typedef std::queue<IPC::Message*> DeferredMessages;
52 50
53 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, 51 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread,
54 bool dead_on_arrival, 52 bool dead_on_arrival,
55 const gpu::GPUInfo& gpu_info, 53 const gpu::GPUInfo& gpu_info,
56 const DeferredMessages& deferred_messages, 54 const DeferredMessages& deferred_messages,
57 GpuMemoryBufferFactory* gpu_memory_buffer_factory, 55 GpuMemoryBufferFactory* gpu_memory_buffer_factory,
58 gpu::SyncPointManager* sync_point_manager); 56 gpu::SyncPointManager* sync_point_manager);
59 57
60 GpuChildThread(const InProcessChildThreadParams& params, 58 GpuChildThread(const InProcessChildThreadParams& params,
61 GpuMemoryBufferFactory* gpu_memory_buffer_factory, 59 GpuMemoryBufferFactory* gpu_memory_buffer_factory,
62 gpu::SyncPointManager* sync_point_manager); 60 gpu::SyncPointManager* sync_point_manager);
63 61
64 ~GpuChildThread() override; 62 ~GpuChildThread() override;
65 63
66 void Shutdown() override; 64 void Shutdown() override;
67 65
68 void Init(const base::Time& process_start_time); 66 void Init(const base::Time& process_start_time);
69 void StopWatchdog(); 67 void StopWatchdog();
70 68
71 // ChildThread overrides. 69 // ChildThread overrides.
72 bool Send(IPC::Message* msg) override; 70 bool Send(IPC::Message* msg) override;
73 bool OnControlMessageReceived(const IPC::Message& msg) override; 71 bool OnControlMessageReceived(const IPC::Message& msg) override;
74 bool OnMessageReceived(const IPC::Message& msg) override; 72 bool OnMessageReceived(const IPC::Message& msg) override;
75 73
76 private: 74 private:
77 // GpuChannelManagerDelegate implementation.
78 void AddSubscription(int32_t client_id, unsigned int target) override;
79 void ChannelEstablished(const IPC::ChannelHandle& channel_handle) override;
80 void DidCreateOffscreenContext(const GURL& active_url) override;
81 void DidDestroyChannel(int client_id) override;
82 void DidDestroyOffscreenContext(const GURL& active_url) override;
83 void DidLoseContext(bool offscreen,
84 gpu::error::ContextLostReason reason,
85 const GURL& active_url) override;
86 void GpuMemoryUmaStats(const GPUMemoryUmaStats& params) override;
87 void RemoveSubscription(int32_t client_id, unsigned int target) override;
88 #if defined(OS_MACOSX)
89 void SendAcceleratedSurfaceBuffersSwapped(
90 const AcceleratedSurfaceBuffersSwappedParams& params) override;
91 #endif
92 #if defined(OS_WIN)
93 void SendAcceleratedSurfaceCreatedChildWindow(
94 const gfx::PluginWindowHandle& parent_window,
95 const gfx::PluginWindowHandle& child_window) override;
96 #endif
97 void StoreShaderToDisk(int32_t client_id,
98 const std::string& key,
99 const std::string& shader) override;
100
101 // Message handlers. 75 // Message handlers.
102 void OnInitialize(); 76 void OnInitialize();
103 void OnFinalize(); 77 void OnFinalize();
104 void OnCollectGraphicsInfo(); 78 void OnCollectGraphicsInfo();
105 void OnGetVideoMemoryUsageStats(); 79 void OnGetVideoMemoryUsageStats();
106 void OnSetVideoMemoryWindowCount(uint32_t window_count); 80 void OnSetVideoMemoryWindowCount(uint32_t window_count);
107 81
108 void OnClean(); 82 void OnClean();
109 void OnCrash(); 83 void OnCrash();
110 void OnHang(); 84 void OnHang();
111 void OnDisableWatchdog(); 85 void OnDisableWatchdog();
112 void OnGpuSwitched(); 86 void OnGpuSwitched();
113 87
114 #if defined(OS_MACOSX)
115 void OnBufferPresented(const BufferPresentedParams& params);
116 #endif
117 void OnEstablishChannel(const EstablishChannelParams& params);
118 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
119 void OnLoadedShader(const std::string& shader);
120 void OnDestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
121 int client_id,
122 const gpu::SyncToken& sync_token);
123 void OnUpdateValueState(int client_id,
124 unsigned int target,
125 const gpu::ValueState& state);
126 #if defined(OS_ANDROID)
127 void OnWakeUpGpu();
128 #endif
129 void OnLoseAllContexts();
130
131 void BindProcessControlRequest( 88 void BindProcessControlRequest(
132 mojo::InterfaceRequest<ProcessControl> request); 89 mojo::InterfaceRequest<ProcessControl> request);
133 90
134 // Set this flag to true if a fatal error occurred before we receive the 91 // Set this flag to true if a fatal error occurred before we receive the
135 // OnInitialize message, in which case we just declare ourselves DOA. 92 // OnInitialize message, in which case we just declare ourselves DOA.
136 bool dead_on_arrival_; 93 bool dead_on_arrival_;
137 base::Time process_start_time_; 94 base::Time process_start_time_;
138 scoped_refptr<GpuWatchdogThread> watchdog_thread_; 95 scoped_refptr<GpuWatchdogThread> watchdog_thread_;
139 96
140 #if defined(OS_WIN) 97 #if defined(OS_WIN)
(...skipping 23 matching lines...) Expand all
164 121
165 // Bindings to the ProcessControl impl. 122 // Bindings to the ProcessControl impl.
166 mojo::WeakBindingSet<ProcessControl> process_control_bindings_; 123 mojo::WeakBindingSet<ProcessControl> process_control_bindings_;
167 124
168 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); 125 DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
169 }; 126 };
170 127
171 } // namespace content 128 } // namespace content
172 129
173 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ 130 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698