| 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "gles2_impl_export.h" | 15 #include "gles2_impl_export.h" |
| 16 #include "gpu/command_buffer/client/client_discardable_manager.h" |
| 16 #include "gpu/command_buffer/client/ref_counted.h" | 17 #include "gpu/command_buffer/client/ref_counted.h" |
| 17 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 namespace gles2 { | 21 namespace gles2 { |
| 21 | 22 |
| 22 class GLES2Implementation; | 23 class GLES2Implementation; |
| 23 class GLES2ImplementationTest; | 24 class GLES2ImplementationTest; |
| 24 class ProgramInfoManager; | 25 class ProgramInfoManager; |
| 25 | 26 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 ++i) { | 146 ++i) { |
| 146 id_handlers_[i]->FreeContext(gl_impl); | 147 id_handlers_[i]->FreeContext(gl_impl); |
| 147 } | 148 } |
| 148 for (auto& range_id_handler : range_id_handlers_) { | 149 for (auto& range_id_handler : range_id_handlers_) { |
| 149 range_id_handler->FreeContext(gl_impl); | 150 range_id_handler->FreeContext(gl_impl); |
| 150 } | 151 } |
| 151 } | 152 } |
| 152 | 153 |
| 153 uint64_t TracingGUID() const { return tracing_guid_; } | 154 uint64_t TracingGUID() const { return tracing_guid_; } |
| 154 | 155 |
| 156 ClientDiscardableManager* discardable_manager() { |
| 157 return &discardable_manager_; |
| 158 } |
| 159 |
| 155 // Mark the ShareGroup as lost when an error occurs on any context in the | 160 // Mark the ShareGroup as lost when an error occurs on any context in the |
| 156 // group. This is thread safe as contexts may be on different threads. | 161 // group. This is thread safe as contexts may be on different threads. |
| 157 void Lose(); | 162 void Lose(); |
| 158 // Report if any context in the ShareGroup has reported itself lost. This is | 163 // Report if any context in the ShareGroup has reported itself lost. This is |
| 159 // thread safe as contexts may be on different threads. | 164 // thread safe as contexts may be on different threads. |
| 160 bool IsLost() const; | 165 bool IsLost() const; |
| 161 | 166 |
| 162 private: | 167 private: |
| 163 friend class gpu::RefCountedThreadSafe<ShareGroup>; | 168 friend class gpu::RefCountedThreadSafe<ShareGroup>; |
| 164 friend class gpu::gles2::GLES2ImplementationTest; | 169 friend class gpu::gles2::GLES2ImplementationTest; |
| 165 ~ShareGroup(); | 170 ~ShareGroup(); |
| 166 | 171 |
| 167 // Install a new program info manager. Used for testing only; | 172 // Install a new program info manager. Used for testing only; |
| 168 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); | 173 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); |
| 169 | 174 |
| 170 std::unique_ptr<IdHandlerInterface> id_handlers_[static_cast<int>( | 175 std::unique_ptr<IdHandlerInterface> id_handlers_[static_cast<int>( |
| 171 SharedIdNamespaces::kNumSharedIdNamespaces)]; | 176 SharedIdNamespaces::kNumSharedIdNamespaces)]; |
| 172 std::unique_ptr<RangeIdHandlerInterface> | 177 std::unique_ptr<RangeIdHandlerInterface> |
| 173 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; | 178 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; |
| 174 std::unique_ptr<ProgramInfoManager> program_info_manager_; | 179 std::unique_ptr<ProgramInfoManager> program_info_manager_; |
| 180 ClientDiscardableManager discardable_manager_; |
| 175 | 181 |
| 176 bool bind_generates_resource_; | 182 bool bind_generates_resource_; |
| 177 uint64_t tracing_guid_; | 183 uint64_t tracing_guid_; |
| 178 | 184 |
| 179 mutable base::Lock lost_lock_; | 185 mutable base::Lock lost_lock_; |
| 180 bool lost_ = false; | 186 bool lost_ = false; |
| 181 | 187 |
| 182 DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 188 DISALLOW_COPY_AND_ASSIGN(ShareGroup); |
| 183 }; | 189 }; |
| 184 | 190 |
| 185 } // namespace gles2 | 191 } // namespace gles2 |
| 186 } // namespace gpu | 192 } // namespace gpu |
| 187 | 193 |
| 188 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 194 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
| OLD | NEW |