| 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_COMMON_GPU_GPU_CHANNEL_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class GpuChannel : public IPC::Channel::Listener, | 38 class GpuChannel : public IPC::Channel::Listener, |
| 39 public IPC::Message::Sender, | 39 public IPC::Message::Sender, |
| 40 public base::RefCountedThreadSafe<GpuChannel> { | 40 public base::RefCountedThreadSafe<GpuChannel> { |
| 41 public: | 41 public: |
| 42 // Takes ownership of the renderer process handle. | 42 // Takes ownership of the renderer process handle. |
| 43 GpuChannel(GpuChannelManager* gpu_channel_manager, | 43 GpuChannel(GpuChannelManager* gpu_channel_manager, |
| 44 GpuWatchdog* watchdog, | 44 GpuWatchdog* watchdog, |
| 45 gfx::GLShareGroup* share_group, | 45 gfx::GLShareGroup* share_group, |
| 46 int client_id, | 46 int client_id, |
| 47 bool software); | 47 bool software); |
| 48 virtual ~GpuChannel(); | |
| 49 | 48 |
| 50 bool Init(base::MessageLoopProxy* io_message_loop, | 49 bool Init(base::MessageLoopProxy* io_message_loop, |
| 51 base::WaitableEvent* shutdown_event); | 50 base::WaitableEvent* shutdown_event); |
| 52 | 51 |
| 53 // Get the GpuChannelManager that owns this channel. | 52 // Get the GpuChannelManager that owns this channel. |
| 54 GpuChannelManager* gpu_channel_manager() const { | 53 GpuChannelManager* gpu_channel_manager() const { |
| 55 return gpu_channel_manager_; | 54 return gpu_channel_manager_; |
| 56 } | 55 } |
| 57 | 56 |
| 58 // Returns the name of the associated IPC channel. | 57 // Returns the name of the associated IPC channel. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 102 |
| 104 // Called to add/remove a listener for a particular message routing ID. | 103 // Called to add/remove a listener for a particular message routing ID. |
| 105 void AddRoute(int32 route_id, IPC::Channel::Listener* listener); | 104 void AddRoute(int32 route_id, IPC::Channel::Listener* listener); |
| 106 void RemoveRoute(int32 route_id); | 105 void RemoveRoute(int32 route_id); |
| 107 | 106 |
| 108 // Indicates whether newly created contexts should prefer the | 107 // Indicates whether newly created contexts should prefer the |
| 109 // discrete GPU even if they would otherwise use the integrated GPU. | 108 // discrete GPU even if they would otherwise use the integrated GPU. |
| 110 bool ShouldPreferDiscreteGpu() const; | 109 bool ShouldPreferDiscreteGpu() const; |
| 111 | 110 |
| 112 private: | 111 private: |
| 112 friend class base::RefCountedThreadSafe<GpuChannel>; |
| 113 virtual ~GpuChannel(); |
| 114 |
| 113 void OnDestroy(); | 115 void OnDestroy(); |
| 114 | 116 |
| 115 bool OnControlMessageReceived(const IPC::Message& msg); | 117 bool OnControlMessageReceived(const IPC::Message& msg); |
| 116 | 118 |
| 117 void HandleMessage(); | 119 void HandleMessage(); |
| 118 void PollWork(int route_id); | 120 void PollWork(int route_id); |
| 119 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay); | 121 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay); |
| 120 | 122 |
| 121 // Message handlers. | 123 // Message handlers. |
| 122 void OnInitialize(base::ProcessHandle renderer_process); | 124 void OnInitialize(base::ProcessHandle renderer_process); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool handle_messages_scheduled_; | 176 bool handle_messages_scheduled_; |
| 175 bool processed_get_state_fast_; | 177 bool processed_get_state_fast_; |
| 176 int32 num_contexts_preferring_discrete_gpu_; | 178 int32 num_contexts_preferring_discrete_gpu_; |
| 177 | 179 |
| 178 base::WeakPtrFactory<GpuChannel> weak_factory_; | 180 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 179 | 181 |
| 180 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 182 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 181 }; | 183 }; |
| 182 | 184 |
| 183 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 185 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |