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

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

Issue 9289052: Adding GpuMemoryManager to track GpuCommandBufferStub visibility and last_used_time and dictate mem… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor updates, working on tests Created 8 years, 10 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
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 "content/common/gpu/gpu_channel_manager.h" 5 #include "content/common/gpu/gpu_channel_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/child_thread.h" 8 #include "content/common/child_thread.h"
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 #include "content/common/gpu/gpu_messages.h" 10 #include "content/common/gpu/gpu_messages.h"
11 #include "content/common/gpu/gpu_memory_manager.h"
11 12
12 GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread, 13 GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread,
13 GpuWatchdog* watchdog, 14 GpuWatchdog* watchdog,
14 base::MessageLoopProxy* io_message_loop, 15 base::MessageLoopProxy* io_message_loop,
15 base::WaitableEvent* shutdown_event) 16 base::WaitableEvent* shutdown_event)
16 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 17 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
17 io_message_loop_(io_message_loop), 18 io_message_loop_(io_message_loop),
18 shutdown_event_(shutdown_event), 19 shutdown_event_(shutdown_event),
19 gpu_child_thread_(gpu_child_thread), 20 gpu_child_thread_(gpu_child_thread),
21 ALLOW_THIS_IN_INITIALIZER_LIST(gpu_memory_manager_(this)),
20 watchdog_(watchdog) { 22 watchdog_(watchdog) {
21 DCHECK(gpu_child_thread); 23 DCHECK(gpu_child_thread);
22 DCHECK(io_message_loop); 24 DCHECK(io_message_loop);
23 DCHECK(shutdown_event); 25 DCHECK(shutdown_event);
24 } 26 }
25 27
26 GpuChannelManager::~GpuChannelManager() { 28 GpuChannelManager::~GpuChannelManager() {
27 gpu_channels_.clear(); 29 gpu_channels_.clear();
28 } 30 }
29 31
(...skipping 16 matching lines...) Expand all
46 } 48 }
47 49
48 GpuChannel* GpuChannelManager::LookupChannel(int32 client_id) { 50 GpuChannel* GpuChannelManager::LookupChannel(int32 client_id) {
49 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id); 51 GpuChannelMap::const_iterator iter = gpu_channels_.find(client_id);
50 if (iter == gpu_channels_.end()) 52 if (iter == gpu_channels_.end())
51 return NULL; 53 return NULL;
52 else 54 else
53 return iter->second; 55 return iter->second;
54 } 56 }
55 57
58 void GpuChannelManager::AppendAllCommandBufferStubs(
59 std::vector<GpuMemoryManageableCommandBufferStub*>& stubs_with_surface,
60 std::vector<GpuMemoryManageableCommandBufferStub*>& stubs_without_surface) {
61 for (GpuChannelMap::const_iterator it = gpu_channels_.begin();
62 it != gpu_channels_.end(); ++it ) {
63 it->second->AppendAllCommandBufferStubs(stubs_with_surface,
64 stubs_without_surface);
65 }
66
67 }
68
56 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) { 69 bool GpuChannelManager::OnMessageReceived(const IPC::Message& msg) {
57 bool msg_is_ok = true; 70 bool msg_is_ok = true;
58 bool handled = true; 71 bool handled = true;
59 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok) 72 IPC_BEGIN_MESSAGE_MAP_EX(GpuChannelManager, msg, msg_is_ok)
60 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) 73 IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel)
61 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) 74 IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel)
62 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer, 75 IPC_MESSAGE_HANDLER(GpuMsg_CreateViewCommandBuffer,
63 OnCreateViewCommandBuffer) 76 OnCreateViewCommandBuffer)
64 IPC_MESSAGE_UNHANDLED(handled = false) 77 IPC_MESSAGE_UNHANDLED(handled = false)
65 IPC_END_MESSAGE_MAP_EX() 78 IPC_END_MESSAGE_MAP_EX()
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void GpuChannelManager::LoseAllContexts() { 147 void GpuChannelManager::LoseAllContexts() {
135 MessageLoop::current()->PostTask( 148 MessageLoop::current()->PostTask(
136 FROM_HERE, 149 FROM_HERE,
137 base::Bind(&GpuChannelManager::OnLoseAllContexts, 150 base::Bind(&GpuChannelManager::OnLoseAllContexts,
138 weak_factory_.GetWeakPtr())); 151 weak_factory_.GetWeakPtr()));
139 } 152 }
140 153
141 void GpuChannelManager::OnLoseAllContexts() { 154 void GpuChannelManager::OnLoseAllContexts() {
142 gpu_channels_.clear(); 155 gpu_channels_.clear();
143 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698