| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 59 OnEstablishChannel) | 59 OnEstablishChannel) |
| 60 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, | 60 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, |
| 61 OnSynchronize) | 61 OnSynchronize) |
| 62 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, | 62 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, |
| 63 OnCollectGraphicsInfo) | 63 OnCollectGraphicsInfo) |
| 64 #if defined(OS_MACOSX) |
| 65 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, |
| 66 OnAcceleratedSurfaceBuffersSwappedACK) |
| 67 #endif |
| 64 IPC_MESSAGE_HANDLER(GpuMsg_Crash, | 68 IPC_MESSAGE_HANDLER(GpuMsg_Crash, |
| 65 OnCrash) | 69 OnCrash) |
| 66 IPC_MESSAGE_HANDLER(GpuMsg_Hang, | 70 IPC_MESSAGE_HANDLER(GpuMsg_Hang, |
| 67 OnHang) | 71 OnHang) |
| 68 IPC_END_MESSAGE_MAP_EX() | 72 IPC_END_MESSAGE_MAP_EX() |
| 69 } | 73 } |
| 70 | 74 |
| 71 void GpuThread::OnEstablishChannel(int renderer_id) { | 75 void GpuThread::OnEstablishChannel(int renderer_id) { |
| 72 scoped_refptr<GpuChannel> channel; | 76 scoped_refptr<GpuChannel> channel; |
| 73 IPC::ChannelHandle channel_handle; | 77 IPC::ChannelHandle channel_handle; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 100 } | 104 } |
| 101 | 105 |
| 102 void GpuThread::OnSynchronize() { | 106 void GpuThread::OnSynchronize() { |
| 103 Send(new GpuHostMsg_SynchronizeReply()); | 107 Send(new GpuHostMsg_SynchronizeReply()); |
| 104 } | 108 } |
| 105 | 109 |
| 106 void GpuThread::OnCollectGraphicsInfo() { | 110 void GpuThread::OnCollectGraphicsInfo() { |
| 107 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); | 111 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); |
| 108 } | 112 } |
| 109 | 113 |
| 114 #if defined(OS_MACOSX) |
| 115 void GpuThread::OnAcceleratedSurfaceBuffersSwappedACK( |
| 116 int renderer_id, int32 route_id, uint64 swap_buffers_count) { |
| 117 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
| 118 if (iter == gpu_channels_.end()) |
| 119 return; |
| 120 scoped_refptr<GpuChannel> channel = iter->second; |
| 121 channel->AcceleratedSurfaceBuffersSwapped(route_id, swap_buffers_count); |
| 122 } |
| 123 #endif |
| 124 |
| 110 void GpuThread::OnCrash() { | 125 void GpuThread::OnCrash() { |
| 111 // Good bye, cruel world. | 126 // Good bye, cruel world. |
| 112 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; | 127 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; |
| 113 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; | 128 *it_s_the_end_of_the_world_as_we_know_it = 0xdead; |
| 114 } | 129 } |
| 115 | 130 |
| 116 void GpuThread::OnHang() { | 131 void GpuThread::OnHang() { |
| 117 for (;;) | 132 for (;;) |
| 118 PlatformThread::Sleep(1000); | 133 PlatformThread::Sleep(1000); |
| 119 } | 134 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 133 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 148 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
| 134 } | 149 } |
| 135 | 150 |
| 136 // Runs on the GPU thread. | 151 // Runs on the GPU thread. |
| 137 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 152 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
| 138 thread->gpu_info_.SetDxDiagnostics(node); | 153 thread->gpu_info_.SetDxDiagnostics(node); |
| 139 thread->gpu_info_.SetProgress(GPUInfo::kComplete); | 154 thread->gpu_info_.SetProgress(GPUInfo::kComplete); |
| 140 } | 155 } |
| 141 | 156 |
| 142 #endif | 157 #endif |
| OLD | NEW |