| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 std::vector<GLuint> freed_ids_; | 41 std::vector<GLuint> freed_ids_; |
| 42 uint32_t flush_generation_; | 42 uint32_t flush_generation_; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 IdHandlerData* id_handler_data(int namespace_id) { | 45 IdHandlerData* id_handler_data(int namespace_id) { |
| 46 return &id_handler_data_[namespace_id]; | 46 return &id_handler_data_[namespace_id]; |
| 47 } | 47 } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 IdHandlerData id_handler_data_[id_namespaces::kNumIdNamespaces]; | 50 IdHandlerData id_handler_data_[id_namespaces::kNumSharedIdNamespaces]; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Base class for IdHandlers | 53 // Base class for IdHandlers |
| 54 class IdHandlerInterface { | 54 class IdHandlerInterface { |
| 55 public: | 55 public: |
| 56 IdHandlerInterface() { } | 56 IdHandlerInterface() { } |
| 57 virtual ~IdHandlerInterface() { } | 57 virtual ~IdHandlerInterface() { } |
| 58 | 58 |
| 59 // Makes some ids at or above id_offset. | 59 // Makes some ids at or above id_offset. |
| 60 virtual void MakeIds( | 60 virtual void MakeIds( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 RangeIdHandlerInterface* GetRangeIdHandler(int range_namespace_id) const { | 131 RangeIdHandlerInterface* GetRangeIdHandler(int range_namespace_id) const { |
| 132 return range_id_handlers_[range_namespace_id].get(); | 132 return range_id_handlers_[range_namespace_id].get(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 ProgramInfoManager* program_info_manager() { | 135 ProgramInfoManager* program_info_manager() { |
| 136 return program_info_manager_.get(); | 136 return program_info_manager_.get(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void FreeContext(GLES2Implementation* gl_impl) { | 139 void FreeContext(GLES2Implementation* gl_impl) { |
| 140 for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { | 140 for (int i = 0; i < id_namespaces::kNumSharedIdNamespaces; ++i) { |
| 141 id_handlers_[i]->FreeContext(gl_impl); | 141 id_handlers_[i]->FreeContext(gl_impl); |
| 142 } | 142 } |
| 143 for (auto& range_id_handler : range_id_handlers_) { | 143 for (auto& range_id_handler : range_id_handlers_) { |
| 144 range_id_handler->FreeContext(gl_impl); | 144 range_id_handler->FreeContext(gl_impl); |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 uint64_t TracingGUID() const { return tracing_guid_; } | 148 uint64_t TracingGUID() const { return tracing_guid_; } |
| 149 | 149 |
| 150 // Mark the ShareGroup as lost when an error occurs on any context in the | 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. | 151 // group. This is thread safe as contexts may be on different threads. |
| 152 void Lose(); | 152 void Lose(); |
| 153 // Report if any context in the ShareGroup has reported itself lost. This is | 153 // Report if any context in the ShareGroup has reported itself lost. This is |
| 154 // thread safe as contexts may be on different threads. | 154 // thread safe as contexts may be on different threads. |
| 155 bool IsLost() const; | 155 bool IsLost() const; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 friend class gpu::RefCountedThreadSafe<ShareGroup>; | 158 friend class gpu::RefCountedThreadSafe<ShareGroup>; |
| 159 friend class gpu::gles2::GLES2ImplementationTest; | 159 friend class gpu::gles2::GLES2ImplementationTest; |
| 160 ~ShareGroup(); | 160 ~ShareGroup(); |
| 161 | 161 |
| 162 // Install a new program info manager. Used for testing only; | 162 // Install a new program info manager. Used for testing only; |
| 163 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); | 163 void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); |
| 164 | 164 |
| 165 std::unique_ptr<IdHandlerInterface> | 165 std::unique_ptr<IdHandlerInterface> |
| 166 id_handlers_[id_namespaces::kNumIdNamespaces]; | 166 id_handlers_[id_namespaces::kNumSharedIdNamespaces]; |
| 167 std::unique_ptr<RangeIdHandlerInterface> | 167 std::unique_ptr<RangeIdHandlerInterface> |
| 168 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; | 168 range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; |
| 169 std::unique_ptr<ProgramInfoManager> program_info_manager_; | 169 std::unique_ptr<ProgramInfoManager> program_info_manager_; |
| 170 | 170 |
| 171 bool bind_generates_resource_; | 171 bool bind_generates_resource_; |
| 172 uint64_t tracing_guid_; | 172 uint64_t tracing_guid_; |
| 173 | 173 |
| 174 mutable base::Lock lost_lock_; | 174 mutable base::Lock lost_lock_; |
| 175 bool lost_ = false; | 175 bool lost_ = false; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(ShareGroup); | 177 DISALLOW_COPY_AND_ASSIGN(ShareGroup); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace gles2 | 180 } // namespace gles2 |
| 181 } // namespace gpu | 181 } // namespace gpu |
| 182 | 182 |
| 183 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ | 183 #endif // GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ |
| OLD | NEW |