| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gpu/command_buffer/service/in_process_command_buffer.h" | 5 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 | 944 |
| 945 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); | 945 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); |
| 946 if (!query) | 946 if (!query) |
| 947 callback.Run(); | 947 callback.Run(); |
| 948 else | 948 else |
| 949 query->AddCallback(callback); | 949 query->AddCallback(callback); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} | 952 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} |
| 953 | 953 |
| 954 uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { | |
| 955 base::WaitableEvent completion(true, false); | |
| 956 uint32 stream_id = 0; | |
| 957 base::Callback<uint32(void)> task = | |
| 958 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, | |
| 959 base::Unretained(this), | |
| 960 texture_id); | |
| 961 QueueTask( | |
| 962 base::Bind(&RunTaskWithResult<uint32>, task, &stream_id, &completion)); | |
| 963 completion.Wait(); | |
| 964 return stream_id; | |
| 965 } | |
| 966 | |
| 967 void InProcessCommandBuffer::SetLock(base::Lock*) { | 954 void InProcessCommandBuffer::SetLock(base::Lock*) { |
| 968 } | 955 } |
| 969 | 956 |
| 970 bool InProcessCommandBuffer::IsGpuChannelLost() { | 957 bool InProcessCommandBuffer::IsGpuChannelLost() { |
| 971 // There is no such channel to lose for in-process contexts. This only | 958 // There is no such channel to lose for in-process contexts. This only |
| 972 // makes sense for out-of-process command buffers. | 959 // makes sense for out-of-process command buffers. |
| 973 return false; | 960 return false; |
| 974 } | 961 } |
| 975 | 962 |
| 976 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { | 963 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 callback_on_client_thread); | 1062 callback_on_client_thread); |
| 1076 return wrapped_callback; | 1063 return wrapped_callback; |
| 1077 } | 1064 } |
| 1078 | 1065 |
| 1079 #if defined(OS_ANDROID) | 1066 #if defined(OS_ANDROID) |
| 1080 scoped_refptr<gfx::SurfaceTexture> | 1067 scoped_refptr<gfx::SurfaceTexture> |
| 1081 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 1068 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { |
| 1082 DCHECK(stream_texture_manager_); | 1069 DCHECK(stream_texture_manager_); |
| 1083 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 1070 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
| 1084 } | 1071 } |
| 1072 |
| 1073 uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { |
| 1074 base::WaitableEvent completion(true, false); |
| 1075 uint32 stream_id = 0; |
| 1076 base::Callback<uint32(void)> task = |
| 1077 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, |
| 1078 base::Unretained(this), texture_id); |
| 1079 QueueTask( |
| 1080 base::Bind(&RunTaskWithResult<uint32>, task, &stream_id, &completion)); |
| 1081 completion.Wait(); |
| 1082 return stream_id; |
| 1083 } |
| 1085 #endif | 1084 #endif |
| 1086 | 1085 |
| 1087 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) | 1086 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) |
| 1088 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { | 1087 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { |
| 1089 Start(); | 1088 Start(); |
| 1090 } | 1089 } |
| 1091 | 1090 |
| 1092 GpuInProcessThread::~GpuInProcessThread() { | 1091 GpuInProcessThread::~GpuInProcessThread() { |
| 1093 Stop(); | 1092 Stop(); |
| 1094 } | 1093 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 framebuffer_completeness_cache_ = | 1126 framebuffer_completeness_cache_ = |
| 1128 new gpu::gles2::FramebufferCompletenessCache; | 1127 new gpu::gles2::FramebufferCompletenessCache; |
| 1129 return framebuffer_completeness_cache_; | 1128 return framebuffer_completeness_cache_; |
| 1130 } | 1129 } |
| 1131 | 1130 |
| 1132 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1131 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 1133 return sync_point_manager_; | 1132 return sync_point_manager_; |
| 1134 } | 1133 } |
| 1135 | 1134 |
| 1136 } // namespace gpu | 1135 } // namespace gpu |
| OLD | NEW |