OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/framebuffer_manager.h" | 5 #include "gpu/command_buffer/service/framebuffer_manager.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
8 | 8 |
9 namespace gpu { | 9 namespace gpu { |
10 namespace gles2 { | 10 namespace gles2 { |
11 | 11 |
| 12 FramebufferManager::~FramebufferManager() { |
| 13 DCHECK(framebuffer_infos_.empty()); |
| 14 } |
| 15 |
| 16 void FramebufferManager::Destroy(bool have_context) { |
| 17 while (!framebuffer_infos_.empty()) { |
| 18 if (have_context) { |
| 19 FramebufferInfo* info = framebuffer_infos_.begin()->second; |
| 20 if (!info->IsDeleted()) { |
| 21 GLuint service_id = info->service_id(); |
| 22 glDeleteFramebuffersEXT(1, &service_id); |
| 23 info->MarkAsDeleted(); |
| 24 } |
| 25 } |
| 26 framebuffer_infos_.erase(framebuffer_infos_.begin()); |
| 27 } |
| 28 } |
| 29 |
12 void FramebufferManager::CreateFramebufferInfo( | 30 void FramebufferManager::CreateFramebufferInfo( |
13 GLuint client_id, GLuint service_id) { | 31 GLuint client_id, GLuint service_id) { |
14 std::pair<FramebufferInfoMap::iterator, bool> result = | 32 std::pair<FramebufferInfoMap::iterator, bool> result = |
15 framebuffer_infos_.insert( | 33 framebuffer_infos_.insert( |
16 std::make_pair( | 34 std::make_pair( |
17 client_id, | 35 client_id, |
18 FramebufferInfo::Ref(new FramebufferInfo(service_id)))); | 36 FramebufferInfo::Ref(new FramebufferInfo(service_id)))); |
19 DCHECK(result.second); | 37 DCHECK(result.second); |
20 } | 38 } |
21 | 39 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return true; | 74 return true; |
57 } | 75 } |
58 } | 76 } |
59 return false; | 77 return false; |
60 } | 78 } |
61 | 79 |
62 } // namespace gles2 | 80 } // namespace gles2 |
63 } // namespace gpu | 81 } // namespace gpu |
64 | 82 |
65 | 83 |
OLD | NEW |