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/renderer/gpu/stream_texture_host_android.h" | 5 #include "content/renderer/gpu/stream_texture_host_android.h" |
6 | 6 |
7 #include "content/common/gpu/client/gpu_channel_host.h" | 7 #include "content/common/gpu/client/gpu_channel_host.h" |
8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 StreamTextureHost::StreamTextureHost(GpuChannelHost* channel) | 14 StreamTextureHost::StreamTextureHost(GpuChannelHost* channel) |
15 : stream_id_(0), | 15 : stream_id_(0), |
16 listener_(NULL), | 16 listener_(NULL), |
17 channel_(channel), | 17 channel_(channel), |
18 weak_ptr_factory_(this) { | 18 weak_ptr_factory_(this) { |
19 DCHECK(channel); | 19 DCHECK(channel); |
20 } | 20 } |
21 | 21 |
22 StreamTextureHost::~StreamTextureHost() { | 22 StreamTextureHost::~StreamTextureHost() { |
23 if (channel_.get() && stream_id_) | 23 if (channel_.get() && stream_id_) |
24 channel_->RemoveRoute(stream_id_); | 24 channel_->RemoveRoute(stream_id_); |
25 } | 25 } |
26 | 26 |
27 bool StreamTextureHost::BindToCurrentThread(int32 stream_id, | 27 bool StreamTextureHost::BindToCurrentThread(int32_t stream_id, |
28 Listener* listener) { | 28 Listener* listener) { |
29 listener_ = listener; | 29 listener_ = listener; |
30 if (channel_.get() && stream_id && !stream_id_) { | 30 if (channel_.get() && stream_id && !stream_id_) { |
31 stream_id_ = stream_id; | 31 stream_id_ = stream_id; |
32 channel_->AddRoute(stream_id, weak_ptr_factory_.GetWeakPtr()); | 32 channel_->AddRoute(stream_id, weak_ptr_factory_.GetWeakPtr()); |
33 channel_->Send(new GpuStreamTextureMsg_StartListening(stream_id)); | 33 channel_->Send(new GpuStreamTextureMsg_StartListening(stream_id)); |
34 return true; | 34 return true; |
35 } | 35 } |
36 | 36 |
37 return false; | 37 return false; |
(...skipping 22 matching lines...) Expand all Loading... |
60 | 60 |
61 void StreamTextureHost::OnMatrixChanged( | 61 void StreamTextureHost::OnMatrixChanged( |
62 const GpuStreamTextureMsg_MatrixChanged_Params& params) { | 62 const GpuStreamTextureMsg_MatrixChanged_Params& params) { |
63 static_assert(sizeof(params) == sizeof(float) * 16, | 63 static_assert(sizeof(params) == sizeof(float) * 16, |
64 "bad GpuStreamTextureMsg MatrixChanged_Params format"); | 64 "bad GpuStreamTextureMsg MatrixChanged_Params format"); |
65 if (listener_) | 65 if (listener_) |
66 listener_->OnMatrixChanged((const float*)¶ms); | 66 listener_->OnMatrixChanged((const float*)¶ms); |
67 } | 67 } |
68 | 68 |
69 } // namespace content | 69 } // namespace content |
OLD | NEW |