OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/gpu/gpu_thread.h" | 5 #include "chrome/gpu/gpu_thread.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/gfx/gl/gl_context.h" | 10 #include "app/gfx/gl/gl_context.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time); | 48 gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time); |
49 } | 49 } |
50 | 50 |
51 void GpuThread::RemoveChannel(int renderer_id) { | 51 void GpuThread::RemoveChannel(int renderer_id) { |
52 gpu_channels_.erase(renderer_id); | 52 gpu_channels_.erase(renderer_id); |
53 } | 53 } |
54 | 54 |
55 void GpuThread::OnControlMessageReceived(const IPC::Message& msg) { | 55 void GpuThread::OnControlMessageReceived(const IPC::Message& msg) { |
56 bool msg_is_ok = true; | 56 bool msg_is_ok = true; |
57 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) | 57 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) |
58 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, | 58 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
59 OnEstablishChannel) | 59 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
60 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, | 60 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, OnSynchronize) |
61 OnCloseChannel) | 61 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
62 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, | |
63 OnSynchronize) | |
64 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, | |
65 OnCollectGraphicsInfo) | |
66 #if defined(OS_MACOSX) | 62 #if defined(OS_MACOSX) |
67 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, | 63 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, |
68 OnAcceleratedSurfaceBuffersSwappedACK) | 64 OnAcceleratedSurfaceBuffersSwappedACK) |
| 65 IPC_MESSAGE_HANDLER(GpuMsg_DidDestroySurface, OnDidDestroySurface) |
69 #endif | 66 #endif |
70 IPC_MESSAGE_HANDLER(GpuMsg_Crash, | 67 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
71 OnCrash) | 68 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
72 IPC_MESSAGE_HANDLER(GpuMsg_Hang, | |
73 OnHang) | |
74 IPC_END_MESSAGE_MAP_EX() | 69 IPC_END_MESSAGE_MAP_EX() |
75 } | 70 } |
76 | 71 |
77 void GpuThread::OnEstablishChannel(int renderer_id) { | 72 void GpuThread::OnEstablishChannel(int renderer_id) { |
78 scoped_refptr<GpuChannel> channel; | 73 scoped_refptr<GpuChannel> channel; |
79 IPC::ChannelHandle channel_handle; | 74 IPC::ChannelHandle channel_handle; |
80 GPUInfo gpu_info; | 75 GPUInfo gpu_info; |
81 | 76 |
82 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 77 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
83 if (iter == gpu_channels_.end()) | 78 if (iter == gpu_channels_.end()) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 120 |
126 #if defined(OS_MACOSX) | 121 #if defined(OS_MACOSX) |
127 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK( | 122 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK( |
128 int renderer_id, int32 route_id, uint64 swap_buffers_count) { | 123 int renderer_id, int32 route_id, uint64 swap_buffers_count) { |
129 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 124 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
130 if (iter == gpu_channels_.end()) | 125 if (iter == gpu_channels_.end()) |
131 return; | 126 return; |
132 scoped_refptr<GpuChannel> channel = iter->second; | 127 scoped_refptr<GpuChannel> channel = iter->second; |
133 channel->AcceleratedSurfaceBuffersSwapped(route_id, swap_buffers_count); | 128 channel->AcceleratedSurfaceBuffersSwapped(route_id, swap_buffers_count); |
134 } | 129 } |
| 130 void GpuThread::OnDidDestroySurface(int renderer_id, int32 renderer_route_id) { |
| 131 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
| 132 if (iter == gpu_channels_.end()) |
| 133 return; |
| 134 scoped_refptr<GpuChannel> channel = iter->second; |
| 135 channel->DidDestroySurface(renderer_route_id); |
| 136 } |
135 #endif | 137 #endif |
136 | 138 |
137 void GpuThread::OnCrash() { | 139 void GpuThread::OnCrash() { |
138 // Good bye, cruel world. | 140 // Good bye, cruel world. |
139 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 141 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
140 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; | 142 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; |
141 } | 143 } |
142 | 144 |
143 void GpuThread::OnHang() { | 145 void GpuThread::OnHang() { |
144 for (;;) { | 146 for (;;) { |
(...skipping 17 matching lines...) Expand all Loading... |
162 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 164 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
163 } | 165 } |
164 | 166 |
165 // Runs on the GPU thread. | 167 // Runs on the GPU thread. |
166 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 168 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
167 thread->gpu_info_.SetDxDiagnostics(node); | 169 thread->gpu_info_.SetDxDiagnostics(node); |
168 thread->gpu_info_.SetProgress(GPUInfo::kComplete); | 170 thread->gpu_info_.SetProgress(GPUInfo::kComplete); |
169 } | 171 } |
170 | 172 |
171 #endif | 173 #endif |
OLD | NEW |