OLD | NEW |
1 // Copyright (c) 2011 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 | 5 |
6 #include <algorithm> | 6 #include <algorithm> |
7 | 7 |
8 #include "content/renderer/gpu/transport_texture_host.h" | 8 #include "content/renderer/gpu/transport_texture_host.h" |
9 | 9 |
10 // On Mac gl2.h clashes with gpu_messages.h and this problem hasn't been | 10 // On Mac gl2.h clashes with gpu_messages.h and this problem hasn't been |
11 // solved yet so exclude building on Mac. | 11 // solved yet so exclude building on Mac. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 void TransportTextureHost::Destroy() { | 61 void TransportTextureHost::Destroy() { |
62 ReleaseTexturesInternal(); | 62 ReleaseTexturesInternal(); |
63 SendDestroyInternal(); | 63 SendDestroyInternal(); |
64 | 64 |
65 service_->RemoveRoute(host_id_); | 65 service_->RemoveRoute(host_id_); |
66 } | 66 } |
67 | 67 |
68 void TransportTextureHost::GetTextures(TextureUpdateCallback* callback, | 68 void TransportTextureHost::GetTextures( |
69 std::vector<int>* textures) { | 69 const TextureUpdateCallback& callback, std::vector<int>* textures) { |
70 textures->resize(textures_.size()); | 70 textures->resize(textures_.size()); |
71 std::copy(textures_.begin(), textures_.end(), textures->begin()); | 71 std::copy(textures_.begin(), textures_.end(), textures->begin()); |
72 update_callback_.reset(callback); | 72 update_callback_ = callback; |
73 } | 73 } |
74 | 74 |
75 int TransportTextureHost::GetPeerId() { | 75 int TransportTextureHost::GetPeerId() { |
76 return peer_id_; | 76 return peer_id_; |
77 } | 77 } |
78 | 78 |
79 void TransportTextureHost::OnChannelConnected(int32 peer_pid) { | 79 void TransportTextureHost::OnChannelConnected(int32 peer_pid) { |
80 } | 80 } |
81 | 81 |
82 void TransportTextureHost::OnChannelError() { | 82 void TransportTextureHost::OnChannelError() { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Send textures to the GPU process. | 180 // Send textures to the GPU process. |
181 SendTexturesInternal(textures_); | 181 SendTexturesInternal(textures_); |
182 } | 182 } |
183 | 183 |
184 void TransportTextureHost::OnReleaseTextures() { | 184 void TransportTextureHost::OnReleaseTextures() { |
185 // This method will switch thread properly so just call it directly. | 185 // This method will switch thread properly so just call it directly. |
186 ReleaseTexturesInternal(); | 186 ReleaseTexturesInternal(); |
187 } | 187 } |
188 | 188 |
189 void TransportTextureHost::OnTextureUpdated(int texture_id) { | 189 void TransportTextureHost::OnTextureUpdated(int texture_id) { |
190 if (update_callback_.get()) | 190 if (!update_callback_.is_null()) |
191 update_callback_->Run(texture_id); | 191 update_callback_.Run(texture_id); |
192 } | 192 } |
193 | 193 |
194 #endif | 194 #endif |
OLD | NEW |