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 #include "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/common/child_thread.h" | 8 #include "content/common/child_thread.h" |
9 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
10 #include "content/common/gpu/gpu_memory_manager.h" | 10 #include "content/common/gpu/gpu_memory_manager.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 void GpuChannelManager::RemoveChannel(int client_id) { | 37 void GpuChannelManager::RemoveChannel(int client_id) { |
38 gpu_channels_.erase(client_id); | 38 gpu_channels_.erase(client_id); |
39 } | 39 } |
40 | 40 |
41 int GpuChannelManager::GenerateRouteID() { | 41 int GpuChannelManager::GenerateRouteID() { |
42 static int last_id = 0; | 42 static int last_id = 0; |
43 return ++last_id; | 43 return ++last_id; |
44 } | 44 } |
45 | 45 |
46 void GpuChannelManager::AddRoute(int32 routing_id, | 46 void GpuChannelManager::AddRoute(int32 routing_id, IPC::Listener* listener) { |
47 IPC::Channel::Listener* listener) { | |
48 gpu_child_thread_->AddRoute(routing_id, listener); | 47 gpu_child_thread_->AddRoute(routing_id, listener); |
49 } | 48 } |
50 | 49 |
51 void GpuChannelManager::RemoveRoute(int32 routing_id) { | 50 void GpuChannelManager::RemoveRoute(int32 routing_id) { |
52 gpu_child_thread_->RemoveRoute(routing_id); | 51 gpu_child_thread_->RemoveRoute(routing_id); |
53 } | 52 } |
54 | 53 |
55 GpuChannel* GpuChannelManager::LookupChannel(int32 client_id) { | 54 GpuChannel* GpuChannelManager::LookupChannel(int32 client_id) { |
56 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); | 55 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); |
57 if (iter == gpu_channels_.end()) | 56 if (iter == gpu_channels_.end()) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 void GpuChannelManager::LoseAllContexts() { | 153 void GpuChannelManager::LoseAllContexts() { |
155 MessageLoop::current()->PostTask( | 154 MessageLoop::current()->PostTask( |
156 FROM_HERE, | 155 FROM_HERE, |
157 base::Bind(&GpuChannelManager::OnLoseAllContexts, | 156 base::Bind(&GpuChannelManager::OnLoseAllContexts, |
158 weak_factory_.GetWeakPtr())); | 157 weak_factory_.GetWeakPtr())); |
159 } | 158 } |
160 | 159 |
161 void GpuChannelManager::OnLoseAllContexts() { | 160 void GpuChannelManager::OnLoseAllContexts() { |
162 gpu_channels_.clear(); | 161 gpu_channels_.clear(); |
163 } | 162 } |
OLD | NEW |