| 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" |
| 11 #include "base/hash.h" |
| 11 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 12 #include "base/time.h" | 13 #include "base/time.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "content/common/gpu/gpu_channel.h" | 15 #include "content/common/gpu/gpu_channel.h" |
| 15 #include "content/common/gpu/gpu_channel_manager.h" | 16 #include "content/common/gpu/gpu_channel_manager.h" |
| 16 #include "content/common/gpu/gpu_command_buffer_stub.h" | 17 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 17 #include "content/common/gpu/gpu_memory_manager.h" | 18 #include "content/common/gpu/gpu_memory_manager.h" |
| 18 #include "content/common/gpu/gpu_memory_tracking.h" | 19 #include "content/common/gpu/gpu_memory_tracking.h" |
| 19 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
| 20 #include "content/common/gpu/gpu_watchdog.h" | 21 #include "content/common/gpu/gpu_watchdog.h" |
| 21 #include "content/common/gpu/image_transport_surface.h" | 22 #include "content/common/gpu/image_transport_surface.h" |
| 22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 23 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 23 #include "content/common/gpu/sync_point_manager.h" | 24 #include "content/common/gpu/sync_point_manager.h" |
| 24 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
| 25 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
| 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 27 #include "gpu/command_buffer/service/memory_tracking.h" | 28 #include "gpu/command_buffer/service/memory_tracking.h" |
| 28 #include "net/disk_cache/hash.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 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // The GpuCommandBufferMemoryTracker class provides a bridge between the | 38 // The GpuCommandBufferMemoryTracker class provides a bridge between the |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 route_id_(route_id), | 116 route_id_(route_id), |
| 117 software_(software), | 117 software_(software), |
| 118 client_has_memory_allocation_changed_callback_(false), | 118 client_has_memory_allocation_changed_callback_(false), |
| 119 last_flush_count_(0), | 119 last_flush_count_(0), |
| 120 parent_stub_for_initialization_(), | 120 parent_stub_for_initialization_(), |
| 121 parent_texture_for_initialization_(0), | 121 parent_texture_for_initialization_(0), |
| 122 watchdog_(watchdog), | 122 watchdog_(watchdog), |
| 123 sync_point_wait_count_(0), | 123 sync_point_wait_count_(0), |
| 124 delayed_work_scheduled_(false), | 124 delayed_work_scheduled_(false), |
| 125 active_url_(active_url) { | 125 active_url_(active_url) { |
| 126 active_url_hash_ = | 126 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); |
| 127 disk_cache::Hash(active_url.possibly_invalid_spec()); | |
| 128 FastSetActiveURL(active_url_, active_url_hash_); | 127 FastSetActiveURL(active_url_, active_url_hash_); |
| 129 if (share_group) { | 128 if (share_group) { |
| 130 context_group_ = share_group->context_group_; | 129 context_group_ = share_group->context_group_; |
| 131 } else { | 130 } else { |
| 132 context_group_ = new gpu::gles2::ContextGroup( | 131 context_group_ = new gpu::gles2::ContextGroup( |
| 133 mailbox_manager, | 132 mailbox_manager, |
| 134 new GpuCommandBufferMemoryTracker(channel), | 133 new GpuCommandBufferMemoryTracker(channel), |
| 135 true); | 134 true); |
| 136 } | 135 } |
| 137 if (surface_id != 0) | 136 if (surface_id != 0) |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 const GpuMemoryAllocation& allocation) { | 831 const GpuMemoryAllocation& allocation) { |
| 833 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); | 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); |
| 834 // This can be called outside of OnMessageReceived, so the context needs to be | 833 // This can be called outside of OnMessageReceived, so the context needs to be |
| 835 // made current before calling methods on the surface. | 834 // made current before calling methods on the surface. |
| 836 if (!surface_ || !MakeCurrent()) | 835 if (!surface_ || !MakeCurrent()) |
| 837 return; | 836 return; |
| 838 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); | 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); |
| 839 } | 838 } |
| 840 | 839 |
| 841 #endif // defined(ENABLE_GPU) | 840 #endif // defined(ENABLE_GPU) |
| OLD | NEW |