| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int GenerateRouteID(); | 98 int GenerateRouteID(); |
| 100 | 99 |
| 101 // Called to add/remove a listener for a particular message routing ID. | 100 // Called to add/remove a listener for a particular message routing ID. |
| 102 void AddRoute(int32 route_id, IPC::Channel::Listener* listener); | 101 void AddRoute(int32 route_id, IPC::Channel::Listener* listener); |
| 103 void RemoveRoute(int32 route_id); | 102 void RemoveRoute(int32 route_id); |
| 104 | 103 |
| 105 // Indicates whether newly created contexts should prefer the | 104 // Indicates whether newly created contexts should prefer the |
| 106 // discrete GPU even if they would otherwise use the integrated GPU. | 105 // discrete GPU even if they would otherwise use the integrated GPU. |
| 107 bool ShouldPreferDiscreteGpu() const; | 106 bool ShouldPreferDiscreteGpu() const; |
| 108 | 107 |
| 108 protected: |
| 109 virtual ~GpuChannel(); |
| 110 |
| 109 private: | 111 private: |
| 112 friend class base::RefCountedThreadSafe<GpuChannel>; |
| 113 |
| 110 void OnDestroy(); | 114 void OnDestroy(); |
| 111 | 115 |
| 112 bool OnControlMessageReceived(const IPC::Message& msg); | 116 bool OnControlMessageReceived(const IPC::Message& msg); |
| 113 | 117 |
| 114 void HandleMessage(); | 118 void HandleMessage(); |
| 115 void PollWork(int route_id); | 119 void PollWork(int route_id); |
| 116 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay); | 120 void ScheduleDelayedWork(GpuCommandBufferStub *stub, int64 delay); |
| 117 | 121 |
| 118 // Message handlers. | 122 // Message handlers. |
| 119 void OnCreateOffscreenCommandBuffer( | 123 void OnCreateOffscreenCommandBuffer( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bool handle_messages_scheduled_; | 168 bool handle_messages_scheduled_; |
| 165 bool processed_get_state_fast_; | 169 bool processed_get_state_fast_; |
| 166 int32 num_contexts_preferring_discrete_gpu_; | 170 int32 num_contexts_preferring_discrete_gpu_; |
| 167 | 171 |
| 168 base::WeakPtrFactory<GpuChannel> weak_factory_; | 172 base::WeakPtrFactory<GpuChannel> weak_factory_; |
| 169 | 173 |
| 170 DISALLOW_COPY_AND_ASSIGN(GpuChannel); | 174 DISALLOW_COPY_AND_ASSIGN(GpuChannel); |
| 171 }; | 175 }; |
| 172 | 176 |
| 173 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ | 177 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ |
| OLD | NEW |