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

Side by Side Diff: gpu/command_buffer/client/mapped_memory.cc

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.h ('k') | gpu/command_buffer/service/feature_info.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "gpu/command_buffer/client/mapped_memory.h" 5 #include "gpu/command_buffer/client/mapped_memory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 12 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
13 13
14 namespace gpu { 14 namespace gpu {
15 15
16 MemoryChunk::MemoryChunk(int32 shm_id, 16 MemoryChunk::MemoryChunk(int32 shm_id,
17 scoped_refptr<gpu::Buffer> shm, 17 scoped_refptr<gpu::Buffer> shm,
18 CommandBufferHelper* helper, 18 CommandBufferHelper* helper,
19 const base::Closure& poll_callback) 19 const base::Closure& poll_callback)
20 : shm_id_(shm_id), 20 : shm_id_(shm_id),
21 shm_(shm), 21 shm_(shm),
22 allocator_(shm->size(), helper, poll_callback, shm->memory()) {} 22 allocator_(shm->size(), helper, poll_callback, shm->memory()) {}
23 23
24 MemoryChunk::~MemoryChunk() {} 24 MemoryChunk::~MemoryChunk() {}
25 25
26 MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper, 26 MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
27 const base::Closure& poll_callback, 27 const base::Closure& poll_callback,
28 size_t unused_memory_reclaim_limit) 28 size_t unused_memory_reclaim_limit)
29 : chunk_size_multiple_(1), 29 : chunk_size_multiple_(FencedAllocator::kAllocAlignment),
30 helper_(helper), 30 helper_(helper),
31 poll_callback_(poll_callback), 31 poll_callback_(poll_callback),
32 allocated_memory_(0), 32 allocated_memory_(0),
33 max_free_bytes_(unused_memory_reclaim_limit) { 33 max_free_bytes_(unused_memory_reclaim_limit) {
34 } 34 }
35 35
36 MappedMemoryManager::~MappedMemoryManager() { 36 MappedMemoryManager::~MappedMemoryManager() {
37 CommandBuffer* cmd_buf = helper_->command_buffer(); 37 CommandBuffer* cmd_buf = helper_->command_buffer();
38 for (MemoryChunkVector::iterator iter = chunks_.begin(); 38 for (MemoryChunkVector::iterator iter = chunks_.begin();
39 iter != chunks_.end(); ++iter) { 39 iter != chunks_.end(); ++iter) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 cmd_buf->DestroyTransferBuffer(chunk->shm_id()); 134 cmd_buf->DestroyTransferBuffer(chunk->shm_id());
135 allocated_memory_ -= chunk->GetSize(); 135 allocated_memory_ -= chunk->GetSize();
136 iter = chunks_.erase(iter); 136 iter = chunks_.erase(iter);
137 } else { 137 } else {
138 ++iter; 138 ++iter;
139 } 139 }
140 } 140 }
141 } 141 }
142 142
143 } // namespace gpu 143 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory.h ('k') | gpu/command_buffer/service/feature_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698