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