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 "gpu/command_buffer/service/buffer_manager.h" | 5 #include "gpu/command_buffer/service/buffer_manager.h" |
6 #include <limits> | 6 #include <limits> |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/service/error_state.h" | 10 #include "gpu/command_buffer/service/error_state.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void BufferManager::CreateBuffer(GLuint client_id, GLuint service_id) { | 43 void BufferManager::CreateBuffer(GLuint client_id, GLuint service_id) { |
44 scoped_refptr<Buffer> buffer(new Buffer(this, service_id)); | 44 scoped_refptr<Buffer> buffer(new Buffer(this, service_id)); |
45 std::pair<BufferMap::iterator, bool> result = | 45 std::pair<BufferMap::iterator, bool> result = |
46 buffers_.insert(std::make_pair(client_id, buffer)); | 46 buffers_.insert(std::make_pair(client_id, buffer)); |
47 DCHECK(result.second); | 47 DCHECK(result.second); |
48 } | 48 } |
49 | 49 |
50 Buffer* BufferManager::GetBuffer( | 50 Buffer* BufferManager::GetBuffer( |
51 GLuint client_id) { | 51 GLuint client_id) { |
52 BufferMap::iterator it = buffers_.find(client_id); | 52 BufferMap::iterator it = buffers_.find(client_id); |
53 return it != buffers_.end() ? it->second : NULL; | 53 return it != buffers_.end() ? it->second.get() : NULL; |
54 } | 54 } |
55 | 55 |
56 void BufferManager::RemoveBuffer(GLuint client_id) { | 56 void BufferManager::RemoveBuffer(GLuint client_id) { |
57 BufferMap::iterator it = buffers_.find(client_id); | 57 BufferMap::iterator it = buffers_.find(client_id); |
58 if (it != buffers_.end()) { | 58 if (it != buffers_.end()) { |
59 Buffer* buffer = it->second.get(); | 59 Buffer* buffer = it->second.get(); |
60 buffer->MarkAsDeleted(); | 60 buffer->MarkAsDeleted(); |
61 buffers_.erase(it); | 61 buffers_.erase(it); |
62 } | 62 } |
63 } | 63 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (buffer->target() == 0) { | 313 if (buffer->target() == 0) { |
314 buffer->set_target(target); | 314 buffer->set_target(target); |
315 } | 315 } |
316 return true; | 316 return true; |
317 } | 317 } |
318 | 318 |
319 } // namespace gles2 | 319 } // namespace gles2 |
320 } // namespace gpu | 320 } // namespace gpu |
321 | 321 |
322 | 322 |
OLD | NEW |