| 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 15 matching lines...) Expand all Loading... |
| 26 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
| 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 28 #include "gpu/command_buffer/service/memory_tracking.h" | 28 #include "gpu/command_buffer/service/memory_tracking.h" |
| 29 #include "ui/gl/gl_bindings.h" | 29 #include "ui/gl/gl_bindings.h" |
| 30 #include "ui/gl/gl_switches.h" | 30 #include "ui/gl/gl_switches.h" |
| 31 | 31 |
| 32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 33 #include "content/public/common/sandbox_init.h" | 33 #include "content/public/common/sandbox_init.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(OS_ANDROID) |
| 37 #include "content/common/gpu/stream_texture_manager_android.h" |
| 38 #endif |
| 39 |
| 36 namespace { | 40 namespace { |
| 37 | 41 |
| 38 // The GpuCommandBufferMemoryTracker class provides a bridge between the | 42 // The GpuCommandBufferMemoryTracker class provides a bridge between the |
| 39 // ContextGroup's memory type managers and the GpuMemoryManager class. | 43 // ContextGroup's memory type managers and the GpuMemoryManager class. |
| 40 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { | 44 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { |
| 41 public: | 45 public: |
| 42 GpuCommandBufferMemoryTracker(GpuChannel* channel) { | 46 GpuCommandBufferMemoryTracker(GpuChannel* channel) { |
| 43 gpu_memory_manager_tracking_group_ = new GpuMemoryTrackingGroup( | 47 gpu_memory_manager_tracking_group_ = new GpuMemoryTrackingGroup( |
| 44 channel->renderer_pid(), | 48 channel->renderer_pid(), |
| 45 channel->gpu_channel_manager()->gpu_memory_manager()); | 49 channel->gpu_channel_manager()->gpu_memory_manager()); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); | 445 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); |
| 442 scheduler_->SetScheduledCallback( | 446 scheduler_->SetScheduledCallback( |
| 443 base::Bind(&GpuCommandBufferStub::OnReschedule, base::Unretained(this))); | 447 base::Bind(&GpuCommandBufferStub::OnReschedule, base::Unretained(this))); |
| 444 | 448 |
| 445 if (watchdog_) { | 449 if (watchdog_) { |
| 446 scheduler_->SetCommandProcessedCallback( | 450 scheduler_->SetCommandProcessedCallback( |
| 447 base::Bind(&GpuCommandBufferStub::OnCommandProcessed, | 451 base::Bind(&GpuCommandBufferStub::OnCommandProcessed, |
| 448 base::Unretained(this))); | 452 base::Unretained(this))); |
| 449 } | 453 } |
| 450 | 454 |
| 455 #if defined(OS_ANDROID) |
| 456 decoder_->SetStreamTextureManager(channel_->stream_texture_manager()); |
| 457 #endif |
| 458 |
| 451 if (parent_stub_for_initialization_) { | 459 if (parent_stub_for_initialization_) { |
| 452 decoder_->SetParent(parent_stub_for_initialization_->decoder_.get(), | 460 decoder_->SetParent(parent_stub_for_initialization_->decoder_.get(), |
| 453 parent_texture_for_initialization_); | 461 parent_texture_for_initialization_); |
| 454 parent_stub_for_initialization_.reset(); | 462 parent_stub_for_initialization_.reset(); |
| 455 parent_texture_for_initialization_ = 0; | 463 parent_texture_for_initialization_ = 0; |
| 456 } | 464 } |
| 457 | 465 |
| 458 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); | 466 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); |
| 459 Send(reply_message); | 467 Send(reply_message); |
| 460 | 468 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 const GpuMemoryAllocation& allocation) { | 839 const GpuMemoryAllocation& allocation) { |
| 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 840 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
| 833 // This can be called outside of OnMessageReceived, so the context needs to be | 841 // This can be called outside of OnMessageReceived, so the context needs to be |
| 834 // made current before calling methods on the surface. | 842 // made current before calling methods on the surface. |
| 835 if (!surface_ || !MakeCurrent()) | 843 if (!surface_ || !MakeCurrent()) |
| 836 return; | 844 return; |
| 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 845 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
| 838 } | 846 } |
| 839 | 847 |
| 840 #endif // defined(ENABLE_GPU) | 848 #endif // defined(ENABLE_GPU) |
| OLD | NEW |