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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 12717013: Add reference-counting for mailbox textures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add optional 'pool' reference while textures are in mailbox Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/common/gpu/gpu_channel.h" 13 #include "content/common/gpu/gpu_channel.h"
14 #include "content/common/gpu/gpu_channel_manager.h" 14 #include "content/common/gpu/gpu_channel_manager.h"
15 #include "content/common/gpu/gpu_command_buffer_stub.h" 15 #include "content/common/gpu/gpu_command_buffer_stub.h"
16 #include "content/common/gpu/gpu_memory_manager.h" 16 #include "content/common/gpu/gpu_memory_manager.h"
17 #include "content/common/gpu/gpu_memory_tracking.h" 17 #include "content/common/gpu/gpu_memory_tracking.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/common/gpu/gpu_watchdog.h" 19 #include "content/common/gpu/gpu_watchdog.h"
20 #include "content/common/gpu/image_transport_surface.h" 20 #include "content/common/gpu/image_transport_surface.h"
21 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" 21 #include "content/common/gpu/media/gpu_video_decode_accelerator.h"
22 #include "content/common/gpu/sync_point_manager.h" 22 #include "content/common/gpu/sync_point_manager.h"
23 #include "content/public/common/content_client.h" 23 #include "content/public/common/content_client.h"
24 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
25 #include "gpu/command_buffer/common/constants.h" 25 #include "gpu/command_buffer/common/constants.h"
26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 26 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
27 #include "gpu/command_buffer/service/gl_context_virtual.h" 27 #include "gpu/command_buffer/service/gl_context_virtual.h"
28 #include "gpu/command_buffer/service/mailbox_manager.h"
28 #include "gpu/command_buffer/service/memory_tracking.h" 29 #include "gpu/command_buffer/service/memory_tracking.h"
29 #include "ui/gl/gl_bindings.h" 30 #include "ui/gl/gl_bindings.h"
30 #include "ui/gl/gl_switches.h" 31 #include "ui/gl/gl_switches.h"
31 32
32 #if defined(OS_WIN) 33 #if defined(OS_WIN)
33 #include "content/public/common/sandbox_init.h" 34 #include "content/public/common/sandbox_init.h"
34 #endif 35 #endif
35 36
36 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
37 #include "content/common/gpu/stream_texture_manager_android.h" 38 #include "content/common/gpu/stream_texture_manager_android.h"
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // to be made current before calling methods on the surface. 934 // to be made current before calling methods on the surface.
934 if (surface_ && MakeCurrent()) 935 if (surface_ && MakeCurrent())
935 surface_->SetFrontbufferAllocation( 936 surface_->SetFrontbufferAllocation(
936 allocation.browser_allocation.suggest_have_frontbuffer); 937 allocation.browser_allocation.suggest_have_frontbuffer);
937 } 938 }
938 939
939 last_memory_allocation_valid_ = true; 940 last_memory_allocation_valid_ = true;
940 last_memory_allocation_ = allocation; 941 last_memory_allocation_ = allocation;
941 } 942 }
942 943
944 void GpuCommandBufferStub::OnDestroySurface(int surface_id) {
945 gpu::gles2::MailboxManager* manager = context_group_->mailbox_manager();
946 if (manager) {
947 manager->RemoveTexturesFromPool(
948 std::make_pair(gpu::gles2::MailboxManager::TEXTURE_POOL_FOR_SURFACE,
949 surface_id),
950 MakeCurrent());
951 }
952 }
953
943 } // namespace content 954 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698