| 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" | |
| 15 #include "gles2_impl_export.h" | 14 #include "gles2_impl_export.h" |
| 16 #include "gpu/command_buffer/client/ref_counted.h" | 15 #include "gpu/command_buffer/client/ref_counted.h" |
| 17 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 18 | 17 |
| 19 namespace gpu { | 18 namespace gpu { |
| 20 namespace gles2 { | 19 namespace gles2 { |
| 21 | 20 |
| 22 class GLES2Implementation; | 21 class GLES2Implementation; |
| 23 class GLES2ImplementationTest; | 22 class GLES2ImplementationTest; |
| 24 class ProgramInfoManager; | 23 class ProgramInfoManager; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { | 139 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { |
| 141 id_handlers_[i]->FreeContext(gl_impl); | 140 id_handlers_[i]->FreeContext(gl_impl); |
| 142 } | 141 } |
| 143 for (auto& range_id_handler : range_id_handlers_) { | 142 for (auto& range_id_handler : range_id_handlers_) { |
| 144 range_id_handler->FreeContext(gl_impl); | 143 range_id_handler->FreeContext(gl_impl); |
| 145 } | 144 } |
| 146 } | 145 } |
| 147 | 146 |
| 148 uint64_t TracingGUID() const { return tracing_guid_; } | 147 uint64_t TracingGUID() const { return tracing_guid_; } |
| 149 | 148 |
| 150 // Mark the ShareGroup as lost when an error occurs on any context in the | |
| 151 // group. This is thread safe as contexts may be on different threads. | |
| 152 void Lose(); | |
| 153 // Report if any context in the ShareGroup has reported itself lost. This is | |
| 154 // thread safe as contexts may be on different threads. | |
| 155 bool IsLost() const; | |
| 156 | |
| 157 private: | 149 private: |
| 158 friend class gpu::RefCountedThreadSafe<ShareGroup>; | 150 friend class gpu::RefCountedThreadSafe<ShareGroup>; |
| 159 friend class gpu::gles2::GLES2ImplementationTest; | 151 friend class gpu::gles2::GLES2ImplementationTest; |
| 160 ~ShareGroup(); | 152 ~ShareGroup(); |
| 161 | 153 |
| 162 // Install a new program info manager. Used for testing only; | 154 // Install a new program info manager. Used for testing only; |
| 163 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); | 155 void set_program_info_manager(ProgramInfoManager* manager); |
| 164 | 156 |
| 165 std::unique_ptr<IdHandlerInterface> | 157 std::unique_ptr<IdHandlerInterface> |
| 166 id_handlers_[id_namespaces::kNumIdNamespaces]; | 158 id_handlers_[id_namespaces::kNumIdNamespaces]; |
| 167 std::unique_ptr<RangeIdHandlerInterface> | 159 std::unique_ptr<RangeIdHandlerInterface> |
| 168 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; | 160 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; |
| 169 std::unique_ptr<ProgramInfoManager> program_info_manager_; | 161 std::unique_ptr<ProgramInfoManager> program_info_manager_; |
| 170 | 162 |
| 171 bool bind_generates_resource_; | 163 bool bind_generates_resource_; |
| 172 uint64_t tracing_guid_; | 164 uint64_t tracing_guid_; |
| 173 | 165 |
| 174 mutable base::Lock lost_lock_; | |
| 175 bool lost_ = false; | |
| 176 | |
| 177 DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 166 DISALLOW_COPY_AND_ASSIGN(ShareGroup); |
| 178 }; | 167 }; |
| 179 | 168 |
| 180 } // namespace gles2 | 169 } // namespace gles2 |
| 181 } // namespace gpu | 170 } // namespace gpu |
| 182 | 171 |
| 183 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 172 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
| OLD | NEW |