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

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: Fix bad merge 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 delayed_work_pending_(false), 181 delayed_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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 845
843 void InProcessCommandBuffer::SetLock(base::Lock*) { 846 void InProcessCommandBuffer::SetLock(base::Lock*) {
844 } 847 }
845 848
846 bool InProcessCommandBuffer::IsGpuChannelLost() { 849 bool InProcessCommandBuffer::IsGpuChannelLost() {
847 // There is no such channel to lose for in-process contexts. This only 850 // There is no such channel to lose for in-process contexts. This only
848 // makes sense for out-of-process command buffers. 851 // makes sense for out-of-process command buffers.
849 return false; 852 return false;
850 } 853 }
851 854
855 CommandBufferNamespace InProcessCommandBuffer::GetNamespaceID() const {
856 return CommandBufferNamespace::IN_PROCESS;
857 }
858
859 uint64_t InProcessCommandBuffer::GetCommandBufferID() const {
860 return command_buffer_id_;
861 }
862
852 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread( 863 uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread(
853 uint32 client_texture_id) { 864 uint32 client_texture_id) {
854 #if defined(OS_ANDROID) 865 #if defined(OS_ANDROID)
855 return stream_texture_manager_->CreateStreamTexture( 866 return stream_texture_manager_->CreateStreamTexture(
856 client_texture_id, decoder_->GetContextGroup()->texture_manager()); 867 client_texture_id, decoder_->GetContextGroup()->texture_manager());
857 #else 868 #else
858 return 0; 869 return 0;
859 #endif 870 #endif
860 } 871 }
861 872
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 framebuffer_completeness_cache_ = 967 framebuffer_completeness_cache_ =
957 new gpu::gles2::FramebufferCompletenessCache; 968 new gpu::gles2::FramebufferCompletenessCache;
958 return framebuffer_completeness_cache_; 969 return framebuffer_completeness_cache_;
959 } 970 }
960 971
961 SyncPointManager* GpuInProcessThread::sync_point_manager() { 972 SyncPointManager* GpuInProcessThread::sync_point_manager() {
962 return sync_point_manager_; 973 return sync_point_manager_;
963 } 974 }
964 975
965 } // namespace gpu 976 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/in_process_command_buffer.h ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698