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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; | 365 DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; |
366 OnInitializeFailed(reply_message); | 366 OnInitializeFailed(reply_message); |
367 return; | 367 return; |
368 } | 368 } |
369 | 369 |
370 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); | 370 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); |
371 | 371 |
372 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), | 372 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), |
373 decoder_.get(), | 373 decoder_.get(), |
374 decoder_.get())); | 374 decoder_.get())); |
375 if (preempt_by_counter_.get()) | 375 if (preemption_flag_.get()) |
376 scheduler_->SetPreemptByCounter(preempt_by_counter_); | 376 scheduler_->SetPreemptByFlag(preemption_flag_); |
377 | 377 |
378 decoder_->set_engine(scheduler_.get()); | 378 decoder_->set_engine(scheduler_.get()); |
379 | 379 |
380 if (!handle_.is_null()) { | 380 if (!handle_.is_null()) { |
381 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 381 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
382 if (software_) { | 382 if (software_) { |
383 DLOG(ERROR) << "No software support.\n"; | 383 DLOG(ERROR) << "No software support.\n"; |
384 OnInitializeFailed(reply_message); | 384 OnInitializeFailed(reply_message); |
385 return; | 385 return; |
386 } | 386 } |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 void GpuCommandBufferStub::AddDestructionObserver( | 876 void GpuCommandBufferStub::AddDestructionObserver( |
877 DestructionObserver* observer) { | 877 DestructionObserver* observer) { |
878 destruction_observers_.AddObserver(observer); | 878 destruction_observers_.AddObserver(observer); |
879 } | 879 } |
880 | 880 |
881 void GpuCommandBufferStub::RemoveDestructionObserver( | 881 void GpuCommandBufferStub::RemoveDestructionObserver( |
882 DestructionObserver* observer) { | 882 DestructionObserver* observer) { |
883 destruction_observers_.RemoveObserver(observer); | 883 destruction_observers_.RemoveObserver(observer); |
884 } | 884 } |
885 | 885 |
886 void GpuCommandBufferStub::SetPreemptByCounter( | 886 void GpuCommandBufferStub::SetPreemptByFlag( |
887 scoped_refptr<gpu::RefCountedCounter> counter) { | 887 scoped_refptr<gpu::PreemptionFlag> flag) { |
888 preempt_by_counter_ = counter; | 888 preemption_flag_ = flag; |
889 if (scheduler_.get()) | 889 if (scheduler_.get()) |
890 scheduler_->SetPreemptByCounter(preempt_by_counter_); | 890 scheduler_->SetPreemptByFlag(preemption_flag_); |
891 } | 891 } |
892 | 892 |
893 bool GpuCommandBufferStub::GetTotalGpuMemory(size_t* bytes) { | 893 bool GpuCommandBufferStub::GetTotalGpuMemory(size_t* bytes) { |
894 *bytes = total_gpu_memory_; | 894 *bytes = total_gpu_memory_; |
895 return !!total_gpu_memory_; | 895 return !!total_gpu_memory_; |
896 } | 896 } |
897 | 897 |
898 gfx::Size GpuCommandBufferStub::GetSurfaceSize() const { | 898 gfx::Size GpuCommandBufferStub::GetSurfaceSize() const { |
899 if (!surface_) | 899 if (!surface_) |
900 return gfx::Size(); | 900 return gfx::Size(); |
(...skipping 12 matching lines...) Expand all Loading... |
913 // made current before calling methods on the surface. | 913 // made current before calling methods on the surface. |
914 if (!surface_ || !MakeCurrent()) | 914 if (!surface_ || !MakeCurrent()) |
915 return; | 915 return; |
916 surface_->SetFrontbufferAllocation( | 916 surface_->SetFrontbufferAllocation( |
917 allocation.browser_allocation.suggest_have_frontbuffer); | 917 allocation.browser_allocation.suggest_have_frontbuffer); |
918 } | 918 } |
919 | 919 |
920 } // namespace content | 920 } // namespace content |
921 | 921 |
922 #endif // defined(ENABLE_GPU) | 922 #endif // defined(ENABLE_GPU) |
OLD | NEW |