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/client/buffer_tracker.h" | 5 #include "gpu/command_buffer/client/buffer_tracker.h" |
6 | 6 |
7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
8 #include "gpu/command_buffer/client/mapped_memory.h" | 8 #include "gpu/command_buffer/client/mapped_memory.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 void BufferTracker::FreePendingToken(Buffer* buffer, int32 token) { | 56 void BufferTracker::FreePendingToken(Buffer* buffer, int32 token) { |
57 if (buffer->address_) | 57 if (buffer->address_) |
58 mapped_memory_->FreePendingToken(buffer->address_, token); | 58 mapped_memory_->FreePendingToken(buffer->address_, token); |
59 buffer->size_ = 0; | 59 buffer->size_ = 0; |
60 buffer->shm_id_ = 0; | 60 buffer->shm_id_ = 0; |
61 buffer->shm_offset_ = 0; | 61 buffer->shm_offset_ = 0; |
62 buffer->address_ = NULL; | 62 buffer->address_ = NULL; |
| 63 buffer->last_usage_token_ = 0; |
| 64 buffer->last_async_upload_token_ = 0; |
63 } | 65 } |
64 | 66 |
| 67 void BufferTracker::Unmanage(Buffer* buffer) { |
| 68 buffer->size_ = 0; |
| 69 buffer->shm_id_ = 0; |
| 70 buffer->shm_offset_ = 0; |
| 71 buffer->address_ = NULL; |
| 72 buffer->last_usage_token_ = 0; |
| 73 buffer->last_async_upload_token_ = 0; |
| 74 } |
| 75 |
| 76 void BufferTracker::Free(Buffer* buffer) { |
| 77 if (buffer->address_) |
| 78 mapped_memory_->Free(buffer->address_); |
| 79 |
| 80 buffer->size_ = 0; |
| 81 buffer->shm_id_ = 0; |
| 82 buffer->shm_offset_ = 0; |
| 83 buffer->address_ = NULL; |
| 84 buffer->last_usage_token_ = 0; |
| 85 buffer->last_async_upload_token_ = 0; |
| 86 } |
65 | 87 |
66 } // namespace gles2 | 88 } // namespace gles2 |
67 } // namespace gpu | 89 } // namespace gpu |
OLD | NEW |