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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Record initialization only after collecting the GPU info because that can | 46 // Record initialization only after collecting the GPU info because that can |
47 // take a significant amount of time. | 47 // take a significant amount of time. |
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 bool GpuThread::OnControlMessageReceived(const IPC::Message& msg) { |
56 bool msg_is_ok = true; | 56 bool msg_is_ok = true; |
| 57 bool handled = true; |
57 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) | 58 IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) |
58 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) | 59 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) |
59 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) | 60 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) |
60 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, OnSynchronize) | 61 IPC_MESSAGE_HANDLER(GpuMsg_Synchronize, OnSynchronize) |
61 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) | 62 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) |
62 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
63 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, | 64 IPC_MESSAGE_HANDLER(GpuMsg_AcceleratedSurfaceBuffersSwappedACK, |
64 OnAcceleratedSurfaceBuffersSwappedACK) | 65 OnAcceleratedSurfaceBuffersSwappedACK) |
65 IPC_MESSAGE_HANDLER(GpuMsg_DidDestroyAcceleratedSurface, | 66 IPC_MESSAGE_HANDLER(GpuMsg_DidDestroyAcceleratedSurface, |
66 OnDidDestroyAcceleratedSurface) | 67 OnDidDestroyAcceleratedSurface) |
67 #endif | 68 #endif |
68 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) | 69 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) |
69 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) | 70 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) |
| 71 IPC_MESSAGE_UNHANDLED(handled = false) |
70 IPC_END_MESSAGE_MAP_EX() | 72 IPC_END_MESSAGE_MAP_EX() |
| 73 return handled; |
71 } | 74 } |
72 | 75 |
73 void GpuThread::OnEstablishChannel(int renderer_id) { | 76 void GpuThread::OnEstablishChannel(int renderer_id) { |
74 scoped_refptr<GpuChannel> channel; | 77 scoped_refptr<GpuChannel> channel; |
75 IPC::ChannelHandle channel_handle; | 78 IPC::ChannelHandle channel_handle; |
76 GPUInfo gpu_info; | 79 GPUInfo gpu_info; |
77 | 80 |
78 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); | 81 GpuChannelMap::const_iterator iter = gpu_channels_.find(renderer_id); |
79 if (iter == gpu_channels_.end()) | 82 if (iter == gpu_channels_.end()) |
80 channel = new GpuChannel(renderer_id); | 83 channel = new GpuChannel(renderer_id); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); | 169 NewRunnableFunction(&GpuThread::SetDxDiagnostics, thread, node)); |
167 } | 170 } |
168 | 171 |
169 // Runs on the GPU thread. | 172 // Runs on the GPU thread. |
170 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { | 173 void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { |
171 thread->gpu_info_.SetDxDiagnostics(node); | 174 thread->gpu_info_.SetDxDiagnostics(node); |
172 thread->gpu_info_.SetProgress(GPUInfo::kComplete); | 175 thread->gpu_info_.SetProgress(GPUInfo::kComplete); |
173 } | 176 } |
174 | 177 |
175 #endif | 178 #endif |
OLD | NEW |