Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.cc

Issue 1345813002: Added a unique command buffer ID for command buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NamespaceID and CommandBufferID for CommandBufferLocal Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 #if defined(OS_WIN) 48 #if defined(OS_WIN)
49 #include <windows.h> 49 #include <windows.h>
50 #include "base/process/process_handle.h" 50 #include "base/process/process_handle.h"
51 #endif 51 #endif
52 52
53 namespace gpu { 53 namespace gpu {
54 54
55 namespace { 55 namespace {
56 56
57 base::StaticAtomicSequenceNumber g_next_command_buffer_id;
58
57 template <typename T> 59 template <typename T>
58 static void RunTaskWithResult(base::Callback<T(void)> task, 60 static void RunTaskWithResult(base::Callback<T(void)> task,
59 T* result, 61 T* result,
60 base::WaitableEvent* completion) { 62 base::WaitableEvent* completion) {
61 *result = task.Run(); 63 *result = task.Run();
62 completion->Signal(); 64 completion->Signal();
63 } 65 }
64 66
65 struct GpuInProcessThreadHolder { 67 struct GpuInProcessThreadHolder {
66 GpuInProcessThreadHolder() 68 GpuInProcessThreadHolder()
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) && 169 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) &&
168 !base::CommandLine::ForCurrentProcess()->HasSwitch( 170 !base::CommandLine::ForCurrentProcess()->HasSwitch(
169 switches::kDisableGpuProgramCache)) { 171 switches::kDisableGpuProgramCache)) {
170 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); 172 program_cache_.reset(new gpu::gles2::MemoryProgramCache());
171 } 173 }
172 return program_cache_.get(); 174 return program_cache_.get();
173 } 175 }
174 176
175 InProcessCommandBuffer::InProcessCommandBuffer( 177 InProcessCommandBuffer::InProcessCommandBuffer(
176 const scoped_refptr<Service>& service) 178 const scoped_refptr<Service>& service)
177 : context_lost_(false), 179 : command_buffer_id_(g_next_command_buffer_id.GetNext()),
180 context_lost_(false),
178 idle_work_pending_(false), 181 idle_work_pending_(false),
179 image_factory_(nullptr), 182 image_factory_(nullptr),
180 last_put_offset_(-1), 183 last_put_offset_(-1),
181 gpu_memory_buffer_manager_(nullptr), 184 gpu_memory_buffer_manager_(nullptr),
182 flush_event_(false, false), 185 flush_event_(false, false),
183 service_(GetInitialService(service)), 186 service_(GetInitialService(service)),
184 gpu_thread_weak_ptr_factory_(this) { 187 gpu_thread_weak_ptr_factory_(this) {
185 DCHECK(service_.get()); 188 DCHECK(service_.get());
186 next_image_id_.GetNext(); 189 next_image_id_.GetNext();
187 } 190 }
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 841
839 void InProcessCommandBuffer::SetLock(base::Lock*) { 842 void InProcessCommandBuffer::SetLock(base::Lock*) {
840 } 843 }
841 844
842 bool InProcessCommandBuffer::IsGpuChannelLost() { 845 bool InProcessCommandBuffer::IsGpuChannelLost() {
843 // There is no such channel to lose for in-process contexts. This only 846 // There is no such channel to lose for in-process contexts. This only
844 // makes sense for out-of-process command buffers. 847 // makes sense for out-of-process command buffers.
845 return false; 848 return false;
846 } 849 }
847 850
851 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const {
852 return kCommandBufferNamespace_InProcess;
853 }
854
855 uint64_t InProcessCommandBuffer::GetCommandBufferID() const {
856 return command_buffer_id_;
857 }
858
848 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( 859 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread(
849 uint32 client_texture_id) { 860 uint32 client_texture_id) {
850 #if defined(OS_ANDROID) 861 #if defined(OS_ANDROID)
851 return stream_texture_manager_->CreateStreamTexture( 862 return stream_texture_manager_->CreateStreamTexture(
852 client_texture_id, decoder_->GetContextGroup()->texture_manager()); 863 client_texture_id, decoder_->GetContextGroup()->texture_manager());
853 #else 864 #else
854 return 0; 865 return 0;
855 #endif 866 #endif
856 } 867 }
857 868
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 framebuffer_completeness_cache_ = 963 framebuffer_completeness_cache_ =
953 new gpu::gles2::FramebufferCompletenessCache; 964 new gpu::gles2::FramebufferCompletenessCache;
954 return framebuffer_completeness_cache_; 965 return framebuffer_completeness_cache_;
955 } 966 }
956 967
957 SyncPointManager* GpuInProcessThread::sync_point_manager() { 968 SyncPointManager* GpuInProcessThread::sync_point_manager() {
958 return sync_point_manager_; 969 return sync_point_manager_;
959 } 970 }
960 971
961 } // namespace gpu 972 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698