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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "gpu/command_buffer/service/logger.h" | 30 #include "gpu/command_buffer/service/logger.h" |
31 #include "gpu/command_buffer/service/memory_tracking.h" | 31 #include "gpu/command_buffer/service/memory_tracking.h" |
32 #include "gpu/command_buffer/service/query_manager.h" | 32 #include "gpu/command_buffer/service/query_manager.h" |
33 #include "ui/gl/gl_bindings.h" | 33 #include "ui/gl/gl_bindings.h" |
34 #include "ui/gl/gl_switches.h" | 34 #include "ui/gl/gl_switches.h" |
35 | 35 |
36 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
37 #include "content/public/common/sandbox_init.h" | 37 #include "content/public/common/sandbox_init.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #if defined(OS_ANDROID) | |
41 #include "content/common/gpu/stream_texture_manager_android.h" | |
42 #endif | |
43 | |
44 namespace content { | 40 namespace content { |
45 namespace { | 41 namespace { |
46 | 42 |
47 // The GpuCommandBufferMemoryTracker class provides a bridge between the | 43 // The GpuCommandBufferMemoryTracker class provides a bridge between the |
48 // ContextGroup's memory type managers and the GpuMemoryManager class. | 44 // ContextGroup's memory type managers and the GpuMemoryManager class. |
49 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { | 45 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { |
50 public: | 46 public: |
51 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : | 47 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : |
52 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> | 48 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> |
53 CreateTrackingGroup(channel->renderer_pid(), this)) { | 49 CreateTrackingGroup(channel->renderer_pid(), this)) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 sync_point_wait_count_(0), | 130 sync_point_wait_count_(0), |
135 delayed_work_scheduled_(false), | 131 delayed_work_scheduled_(false), |
136 previous_messages_processed_(0), | 132 previous_messages_processed_(0), |
137 active_url_(active_url), | 133 active_url_(active_url), |
138 total_gpu_memory_(0) { | 134 total_gpu_memory_(0) { |
139 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); | 135 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); |
140 FastSetActiveURL(active_url_, active_url_hash_); | 136 FastSetActiveURL(active_url_, active_url_hash_); |
141 if (share_group) { | 137 if (share_group) { |
142 context_group_ = share_group->context_group_; | 138 context_group_ = share_group->context_group_; |
143 } else { | 139 } else { |
144 gpu::StreamTextureManager* stream_texture_manager = NULL; | |
145 #if defined(OS_ANDROID) | |
146 stream_texture_manager = channel_->stream_texture_manager(); | |
147 #endif | |
148 context_group_ = new gpu::gles2::ContextGroup( | 140 context_group_ = new gpu::gles2::ContextGroup( |
149 mailbox_manager, | 141 mailbox_manager, |
150 image_manager, | 142 image_manager, |
151 new GpuCommandBufferMemoryTracker(channel), | 143 new GpuCommandBufferMemoryTracker(channel), |
152 stream_texture_manager, | |
153 true); | 144 true); |
154 } | 145 } |
155 } | 146 } |
156 | 147 |
157 GpuCommandBufferStub::~GpuCommandBufferStub() { | 148 GpuCommandBufferStub::~GpuCommandBufferStub() { |
158 Destroy(); | 149 Destroy(); |
159 | 150 |
160 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); | 151 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); |
161 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id())); | 152 gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id())); |
162 } | 153 } |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 command_buffer_->GetState().error == gpu::error::kLostContext) | 932 command_buffer_->GetState().error == gpu::error::kLostContext) |
942 return; | 933 return; |
943 | 934 |
944 command_buffer_->SetContextLostReason(gpu::error::kUnknown); | 935 command_buffer_->SetContextLostReason(gpu::error::kUnknown); |
945 if (decoder_) | 936 if (decoder_) |
946 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 937 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
947 command_buffer_->SetParseError(gpu::error::kLostContext); | 938 command_buffer_->SetParseError(gpu::error::kLostContext); |
948 } | 939 } |
949 | 940 |
950 } // namespace content | 941 } // namespace content |
OLD | NEW |