Index: gpu/command_buffer/client/share_group.h |
diff --git a/gpu/command_buffer/client/share_group.h b/gpu/command_buffer/client/share_group.h |
index 091b69f2385034d354e2f5946dcecabc67d4d2a2..2453eba340cb1a810a834f353a64972d04beb8cb 100644 |
--- a/gpu/command_buffer/client/share_group.h |
+++ b/gpu/command_buffer/client/share_group.h |
@@ -32,6 +32,13 @@ typedef void (GLES2Implementation::*BindIndexedFn)( \ |
typedef void (GLES2Implementation::*BindIndexedRangeFn)( \ |
GLenum target, GLuint index, GLuint id, GLintptr offset, GLsizeiptr size); |
+template <typename Type> |
+inline int ToInt(Type t) { |
Zhenyao Mo
2017/05/11 22:10:57
You don't need this. See my comments in other pla
Chandan
2017/05/12 12:30:31
Done.
|
+ return static_cast<int>(t); |
+} |
+ |
+using SharedIdNamespaces = id_namespaces::SharedIdNamespaces; |
+ |
class ShareGroupContextData { |
public: |
struct IdHandlerData { |
@@ -47,7 +54,8 @@ class ShareGroupContextData { |
} |
private: |
- IdHandlerData id_handler_data_[id_namespaces::kNumIdNamespaces]; |
+ IdHandlerData id_handler_data_[static_cast<int>( |
+ SharedIdNamespaces::kNumSharedIdNamespaces)]; |
}; |
// Base class for IdHandlers |
@@ -137,7 +145,8 @@ class GLES2_IMPL_EXPORT ShareGroup |
} |
void FreeContext(GLES2Implementation* gl_impl) { |
- for (int i = 0; i < id_namespaces::kNumIdNamespaces; ++i) { |
+ for (int i = 0; i < ToInt(SharedIdNamespaces::kNumSharedIdNamespaces); |
+ ++i) { |
id_handlers_[i]->FreeContext(gl_impl); |
} |
for (auto& range_id_handler : range_id_handlers_) { |
@@ -162,8 +171,8 @@ class GLES2_IMPL_EXPORT ShareGroup |
// Install a new program info manager. Used for testing only; |
void SetProgramInfoManagerForTesting(ProgramInfoManager* manager); |
- std::unique_ptr<IdHandlerInterface> |
- id_handlers_[id_namespaces::kNumIdNamespaces]; |
+ std::unique_ptr<IdHandlerInterface> id_handlers_[static_cast<int>( |
+ SharedIdNamespaces::kNumSharedIdNamespaces)]; |
std::unique_ptr<RangeIdHandlerInterface> |
range_id_handlers_[id_namespaces::kNumRangeIdNamespaces]; |
std::unique_ptr<ProgramInfoManager> program_info_manager_; |