Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: gpu/command_buffer/service/context_group.cc

Issue 1176523002: Code style fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "gpu/command_buffer/service/context_group.h" 5 #include "gpu/command_buffer/service/context_group.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 17 matching lines...) Expand all
28 namespace gles2 { 28 namespace gles2 {
29 29
30 ContextGroup::ContextGroup( 30 ContextGroup::ContextGroup(
31 const scoped_refptr<MailboxManager>& mailbox_manager, 31 const scoped_refptr<MailboxManager>& mailbox_manager,
32 const scoped_refptr<MemoryTracker>& memory_tracker, 32 const scoped_refptr<MemoryTracker>& memory_tracker,
33 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, 33 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache,
34 const scoped_refptr<FeatureInfo>& feature_info, 34 const scoped_refptr<FeatureInfo>& feature_info,
35 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, 35 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set,
36 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, 36 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state,
37 bool bind_generates_resource) 37 bool bind_generates_resource)
38 : context_type_(kContextTypeUndefined), 38 : context_type_(CONTEXT_TYPE_UNDEFINED),
39 mailbox_manager_(mailbox_manager), 39 mailbox_manager_(mailbox_manager),
40 memory_tracker_(memory_tracker), 40 memory_tracker_(memory_tracker),
41 shader_translator_cache_(shader_translator_cache), 41 shader_translator_cache_(shader_translator_cache),
42 subscription_ref_set_(subscription_ref_set), 42 subscription_ref_set_(subscription_ref_set),
43 pending_valuebuffer_state_(pending_valuebuffer_state), 43 pending_valuebuffer_state_(pending_valuebuffer_state),
44 enforce_gl_minimums_(base::CommandLine::ForCurrentProcess()->HasSwitch( 44 enforce_gl_minimums_(base::CommandLine::ForCurrentProcess()->HasSwitch(
45 switches::kEnforceGLMinimums)), 45 switches::kEnforceGLMinimums)),
46 bind_generates_resource_(bind_generates_resource), 46 bind_generates_resource_(bind_generates_resource),
47 max_vertex_attribs_(0u), 47 max_vertex_attribs_(0u),
48 max_texture_units_(0u), 48 max_texture_units_(0u),
(...skipping 26 matching lines...) Expand all
75 GLint value = 0; 75 GLint value = 0;
76 glGetIntegerv(pname, &value); 76 glGetIntegerv(pname, &value);
77 *var = value; 77 *var = value;
78 } 78 }
79 79
80 // static 80 // static
81 ContextGroup::ContextType ContextGroup::GetContextType( 81 ContextGroup::ContextType ContextGroup::GetContextType(
82 unsigned webgl_version) { 82 unsigned webgl_version) {
83 switch (webgl_version) { 83 switch (webgl_version) {
84 case 0: 84 case 0:
85 return kContextTypeOther; 85 return CONTEXT_TYPE_OTHER;
86 case 1: 86 case 1:
87 return kContextTypeWebGL1; 87 return CONTEXT_TYPE_WEBGL1;
88 case 2: 88 case 2:
89 return kContextTypeWebGL2; 89 return CONTEXT_TYPE_WEBGL2;
90 default: 90 default:
91 return kContextTypeUndefined; 91 return CONTEXT_TYPE_UNDEFINED;
92 } 92 }
93 } 93 }
94 94
95 bool ContextGroup::Initialize( 95 bool ContextGroup::Initialize(
96 GLES2Decoder* decoder, 96 GLES2Decoder* decoder,
97 ContextGroup::ContextType context_type, 97 ContextGroup::ContextType context_type,
98 const DisallowedFeatures& disallowed_features) { 98 const DisallowedFeatures& disallowed_features) {
99 if (context_type == kContextTypeUndefined) { 99 if (context_type == CONTEXT_TYPE_UNDEFINED) {
100 LOG(ERROR) << "ContextGroup::Initialize failed because of unknown " 100 LOG(ERROR) << "ContextGroup::Initialize failed because of unknown "
101 << "context type."; 101 << "context type.";
102 return false; 102 return false;
103 } 103 }
104 if (context_type_ == kContextTypeUndefined) { 104 if (context_type_ == CONTEXT_TYPE_UNDEFINED) {
105 context_type_ = context_type; 105 context_type_ = context_type;
106 } else if (context_type_ != context_type) { 106 } else if (context_type_ != context_type) {
107 LOG(ERROR) << "ContextGroup::Initialize failed because the type of " 107 LOG(ERROR) << "ContextGroup::Initialize failed because the type of "
108 << "the context does not fit with the group."; 108 << "the context does not fit with the group.";
109 return false; 109 return false;
110 } 110 }
111 111
112 // If we've already initialized the group just add the context. 112 // If we've already initialized the group just add the context.
113 if (HaveContexts()) { 113 if (HaveContexts()) {
114 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder)); 114 decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder));
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 GLuint client_id, GLuint* service_id) const { 445 GLuint client_id, GLuint* service_id) const {
446 Buffer* buffer = buffer_manager_->GetBuffer(client_id); 446 Buffer* buffer = buffer_manager_->GetBuffer(client_id);
447 if (!buffer) 447 if (!buffer)
448 return false; 448 return false;
449 *service_id = buffer->service_id(); 449 *service_id = buffer->service_id();
450 return true; 450 return true;
451 } 451 }
452 452
453 } // namespace gles2 453 } // namespace gles2
454 } // namespace gpu 454 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/context_group.h ('k') | gpu/command_buffer/service/context_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698