OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
9 #include "gpu/command_buffer/service/gl_utils.h" | 9 #include "gpu/command_buffer/service/gl_utils.h" |
10 #include "ui/gl/gl_version_info.h" | 10 #include "ui/gl/gl_version_info.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 GLES2DecoderPassthroughImpl::GLES2DecoderPassthroughImpl(ContextGroup* group) | 73 GLES2DecoderPassthroughImpl::GLES2DecoderPassthroughImpl(ContextGroup* group) |
74 : commands_to_process_(0), | 74 : commands_to_process_(0), |
75 debug_marker_manager_(), | 75 debug_marker_manager_(), |
76 logger_(&debug_marker_manager_), | 76 logger_(&debug_marker_manager_), |
77 surface_(), | 77 surface_(), |
78 context_(), | 78 context_(), |
79 offscreen_(false), | 79 offscreen_(false), |
80 group_(group), | 80 group_(group), |
81 feature_info_(new FeatureInfo) { | 81 feature_info_(new FeatureInfo), |
| 82 weak_ptr_factory_(this) { |
82 DCHECK(group); | 83 DCHECK(group); |
83 } | 84 } |
84 | 85 |
85 GLES2DecoderPassthroughImpl::~GLES2DecoderPassthroughImpl() {} | 86 GLES2DecoderPassthroughImpl::~GLES2DecoderPassthroughImpl() {} |
86 | 87 |
87 GLES2Decoder::Error GLES2DecoderPassthroughImpl::DoCommands( | 88 GLES2Decoder::Error GLES2DecoderPassthroughImpl::DoCommands( |
88 unsigned int num_commands, | 89 unsigned int num_commands, |
89 const volatile void* buffer, | 90 const volatile void* buffer, |
90 int num_entries, | 91 int num_entries, |
91 int* entries_processed) { | 92 int* entries_processed) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 | 148 |
148 const char* GLES2DecoderPassthroughImpl::GetCommandName( | 149 const char* GLES2DecoderPassthroughImpl::GetCommandName( |
149 unsigned int command_id) const { | 150 unsigned int command_id) const { |
150 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { | 151 if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { |
151 return gles2::GetCommandName(static_cast<CommandId>(command_id)); | 152 return gles2::GetCommandName(static_cast<CommandId>(command_id)); |
152 } | 153 } |
153 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); | 154 return GetCommonCommandName(static_cast<cmd::CommandId>(command_id)); |
154 } | 155 } |
155 | 156 |
| 157 base::WeakPtr<GLES2Decoder> GLES2DecoderPassthroughImpl::AsWeakPtr() { |
| 158 return weak_ptr_factory_.GetWeakPtr(); |
| 159 } |
| 160 |
156 bool GLES2DecoderPassthroughImpl::Initialize( | 161 bool GLES2DecoderPassthroughImpl::Initialize( |
157 const scoped_refptr<gl::GLSurface>& surface, | 162 const scoped_refptr<gl::GLSurface>& surface, |
158 const scoped_refptr<gl::GLContext>& context, | 163 const scoped_refptr<gl::GLContext>& context, |
159 bool offscreen, | 164 bool offscreen, |
160 const DisallowedFeatures& disallowed_features, | 165 const DisallowedFeatures& disallowed_features, |
161 const ContextCreationAttribHelper& attrib_helper) { | 166 const ContextCreationAttribHelper& attrib_helper) { |
162 // Take ownership of the context and surface. The surface can be replaced | 167 // Take ownership of the context and surface. The surface can be replaced |
163 // with SetSurface. | 168 // with SetSurface. |
164 context_ = context; | 169 context_ = context; |
165 surface_ = surface; | 170 surface_ = surface; |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 }, /* NOLINT */ | 918 }, /* NOLINT */ |
914 | 919 |
915 const GLES2DecoderPassthroughImpl::CommandInfo | 920 const GLES2DecoderPassthroughImpl::CommandInfo |
916 GLES2DecoderPassthroughImpl::command_info[] = { | 921 GLES2DecoderPassthroughImpl::command_info[] = { |
917 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; | 922 GLES2_COMMAND_LIST(GLES2_CMD_OP)}; |
918 | 923 |
919 #undef GLES2_CMD_OP | 924 #undef GLES2_CMD_OP |
920 | 925 |
921 } // namespace gles2 | 926 } // namespace gles2 |
922 } // namespace gpu | 927 } // namespace gpu |
OLD | NEW |