OLD | NEW |
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 #include "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/win/scoped_com_initializer.h" | 10 #include "app/win/scoped_com_initializer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { | 42 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { |
43 bool msg_is_ok = true; | 43 bool msg_is_ok = true; |
44 bool handled = true; | 44 bool handled = true; |
45 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) | 45 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) |
46 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 46 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
47 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 47 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
48 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, | 48 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, |
49 OnCreateViewCommandBuffer) | 49 OnCreateViewCommandBuffer) |
50 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, OnSynchronize) | |
51 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged) | 50 IPC_MESSAGE_HANDLER(GpuMsg_VisibilityChanged, OnVisibilityChanged) |
52 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) | 51 #if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN) |
53 IPC_MESSAGE_HANDLER(GpuMsg_ResizeViewACK, OnResizeViewACK); | 52 IPC_MESSAGE_HANDLER(GpuMsg_ResizeViewACK, OnResizeViewACK); |
54 #elif defined(OS_MACOSX) | 53 #elif defined(OS_MACOSX) |
55 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, | 54 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, |
56 OnAcceleratedSurfaceBuffersSwappedACK) | 55 OnAcceleratedSurfaceBuffersSwappedACK) |
57 IPC_MESSAGE_HANDLER(GpuMsg_DestroyCommandBuffer, | 56 IPC_MESSAGE_HANDLER(GpuMsg_DestroyCommandBuffer, |
58 OnDestroyCommandBuffer) | 57 OnDestroyCommandBuffer) |
59 #endif | 58 #endif |
60 IPC_MESSAGE_UNHANDLED(handled = false) | 59 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const IPC::ChannelHandle& channel_handle) { | 100 const IPC::ChannelHandle& channel_handle) { |
102 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); | 101 for (GpuChannelMap::iterator iter = gpu_channels_.begin(); |
103 iter != gpu_channels_.end(); ++iter) { | 102 iter != gpu_channels_.end(); ++iter) { |
104 if (iter->second->GetChannelName() == channel_handle.name) { | 103 if (iter->second->GetChannelName() == channel_handle.name) { |
105 gpu_channels_.erase(iter); | 104 gpu_channels_.erase(iter); |
106 return; | 105 return; |
107 } | 106 } |
108 } | 107 } |
109 } | 108 } |
110 | 109 |
111 void GpuChannelManager::OnSynchronize() { | |
112 Send(new GpuHostMsg_SynchronizeReply()); | |
113 } | |
114 | |
115 void GpuChannelManager::OnVisibilityChanged( | 110 void GpuChannelManager::OnVisibilityChanged( |
116 int32 render_view_id, int32 renderer_id, bool visible) { | 111 int32 render_view_id, int32 renderer_id, bool visible) { |
117 // TODO(amarinichev): this will be used for context eviction | 112 // TODO(amarinichev): this will be used for context eviction |
118 } | 113 } |
119 | 114 |
120 void GpuChannelManager::OnCreateViewCommandBuffer( | 115 void GpuChannelManager::OnCreateViewCommandBuffer( |
121 gfx::PluginWindowHandle window, | 116 gfx::PluginWindowHandle window, |
122 int32 render_view_id, | 117 int32 render_view_id, |
123 int32 renderer_id, | 118 int32 renderer_id, |
124 const GPUCreateCommandBufferConfig& init_params) { | 119 const GPUCreateCommandBufferConfig& init_params) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 160 |
166 void GpuChannelManager::LoseAllContexts() { | 161 void GpuChannelManager::LoseAllContexts() { |
167 MessageLoop::current()->PostTask( | 162 MessageLoop::current()->PostTask( |
168 FROM_HERE, method_factory_.NewRunnableMethod( | 163 FROM_HERE, method_factory_.NewRunnableMethod( |
169 &GpuChannelManager::OnLoseAllContexts)); | 164 &GpuChannelManager::OnLoseAllContexts)); |
170 } | 165 } |
171 | 166 |
172 void GpuChannelManager::OnLoseAllContexts() { | 167 void GpuChannelManager::OnLoseAllContexts() { |
173 gpu_channels_.clear(); | 168 gpu_channels_.clear(); |
174 } | 169 } |
OLD | NEW |