| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 | 937 |
| 938 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); | 938 gles2::QueryManager::Query* query = query_manager_->GetQuery(query_id); |
| 939 if (!query) | 939 if (!query) |
| 940 callback.Run(); | 940 callback.Run(); |
| 941 else | 941 else |
| 942 query->AddCallback(callback); | 942 query->AddCallback(callback); |
| 943 } | 943 } |
| 944 | 944 |
| 945 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} | 945 void InProcessCommandBuffer::SetSurfaceVisible(bool visible) {} |
| 946 | 946 |
| 947 uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { | |
| 948 base::WaitableEvent completion(true, false); | |
| 949 uint32 stream_id = 0; | |
| 950 base::Callback<uint32(void)> task = | |
| 951 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, | |
| 952 base::Unretained(this), | |
| 953 texture_id); | |
| 954 QueueTask( | |
| 955 base::Bind(&RunTaskWithResult<uint32>, task, &stream_id, &completion)); | |
| 956 completion.Wait(); | |
| 957 return stream_id; | |
| 958 } | |
| 959 | |
| 960 void InProcessCommandBuffer::SetLock(base::Lock*) { | 947 void InProcessCommandBuffer::SetLock(base::Lock*) { |
| 961 } | 948 } |
| 962 | 949 |
| 963 bool InProcessCommandBuffer::IsGpuChannelLost() { | 950 bool InProcessCommandBuffer::IsGpuChannelLost() { |
| 964 // There is no such channel to lose for in-process contexts. This only | 951 // There is no such channel to lose for in-process contexts. This only |
| 965 // makes sense for out-of-process command buffers. | 952 // makes sense for out-of-process command buffers. |
| 966 return false; | 953 return false; |
| 967 } | 954 } |
| 968 | 955 |
| 969 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { | 956 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 callback_on_client_thread); | 1055 callback_on_client_thread); |
| 1069 return wrapped_callback; | 1056 return wrapped_callback; |
| 1070 } | 1057 } |
| 1071 | 1058 |
| 1072 #if defined(OS_ANDROID) | 1059 #if defined(OS_ANDROID) |
| 1073 scoped_refptr<gfx::SurfaceTexture> | 1060 scoped_refptr<gfx::SurfaceTexture> |
| 1074 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { | 1061 InProcessCommandBuffer::GetSurfaceTexture(uint32 stream_id) { |
| 1075 DCHECK(stream_texture_manager_); | 1062 DCHECK(stream_texture_manager_); |
| 1076 return stream_texture_manager_->GetSurfaceTexture(stream_id); | 1063 return stream_texture_manager_->GetSurfaceTexture(stream_id); |
| 1077 } | 1064 } |
| 1065 |
| 1066 uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) { |
| 1067 base::WaitableEvent completion(true, false); |
| 1068 uint32 stream_id = 0; |
| 1069 base::Callback<uint32(void)> task = |
| 1070 base::Bind(&InProcessCommandBuffer::CreateStreamTextureOnGpuThread, |
| 1071 base::Unretained(this), |
| 1072 texture_id); |
| 1073 QueueTask( |
| 1074 base::Bind(&RunTaskWithResult<uint32>, task, &stream_id, &completion)); |
| 1075 completion.Wait(); |
| 1076 return stream_id; |
| 1077 } |
| 1078 #endif | 1078 #endif |
| 1079 | 1079 |
| 1080 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) | 1080 GpuInProcessThread::GpuInProcessThread(SyncPointManager* sync_point_manager) |
| 1081 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { | 1081 : base::Thread("GpuThread"), sync_point_manager_(sync_point_manager) { |
| 1082 Start(); | 1082 Start(); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 GpuInProcessThread::~GpuInProcessThread() { | 1085 GpuInProcessThread::~GpuInProcessThread() { |
| 1086 Stop(); | 1086 Stop(); |
| 1087 } | 1087 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 framebuffer_completeness_cache_ = | 1120 framebuffer_completeness_cache_ = |
| 1121 new gpu::gles2::FramebufferCompletenessCache; | 1121 new gpu::gles2::FramebufferCompletenessCache; |
| 1122 return framebuffer_completeness_cache_; | 1122 return framebuffer_completeness_cache_; |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 SyncPointManager* GpuInProcessThread::sync_point_manager() { | 1125 SyncPointManager* GpuInProcessThread::sync_point_manager() { |
| 1126 return sync_point_manager_; | 1126 return sync_point_manager_; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 } // namespace gpu | 1129 } // namespace gpu |
| OLD | NEW |