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

Side by Side Diff: content/gpu/gpu_info_collector.cc

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/gpu/gpu_info_collector.h" 5 #include "content/gpu/gpu_info_collector.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "ui/gl/gl_bindings.h" 15 #include "ui/gl/gl_bindings.h"
16 #include "ui/gl/gl_context.h" 16 #include "ui/gl/gl_context.h"
17 #include "ui/gl/gl_surface.h" 17 #include "ui/gl/gl_surface.h"
18 18
19 namespace { 19 namespace {
20 20
21 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { 21 scoped_refptr<gfx::GLSurface> InitializeGLSurface() {
22 scoped_refptr<gfx::GLSurface> surface( 22 scoped_refptr<gfx::GLSurface> surface(
23 gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1))); 23 gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)));
24 if (!surface.get()) { 24 if (!surface) {
25 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed"; 25 LOG(ERROR) << "gfx::GLContext::CreateOffscreenGLSurface failed";
26 return NULL; 26 return NULL;
27 } 27 }
28 28
29 return surface; 29 return surface;
30 } 30 }
31 31
32 scoped_refptr<gfx::GLContext> InitializeGLContext(gfx::GLSurface* surface) { 32 scoped_refptr<gfx::GLContext> InitializeGLContext(gfx::GLSurface* surface) {
33 33
34 scoped_refptr<gfx::GLContext> context( 34 scoped_refptr<gfx::GLContext> context(
35 gfx::GLContext::CreateGLContext(NULL, 35 gfx::GLContext::CreateGLContext(NULL,
36 surface, 36 surface,
37 gfx::PreferIntegratedGpu)); 37 gfx::PreferIntegratedGpu));
38 if (!context.get()) { 38 if (!context) {
39 LOG(ERROR) << "gfx::GLContext::CreateGLContext failed"; 39 LOG(ERROR) << "gfx::GLContext::CreateGLContext failed";
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 if (!context->MakeCurrent(surface)) { 43 if (!context->MakeCurrent(surface)) {
44 LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed"; 44 LOG(ERROR) << "gfx::GLContext::MakeCurrent() failed";
45 return NULL; 45 return NULL;
46 } 46 }
47 47
48 return context; 48 return context;
(...skipping 29 matching lines...) Expand all
78 78
79 namespace gpu_info_collector { 79 namespace gpu_info_collector {
80 80
81 bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info) { 81 bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info) {
82 if (!gfx::GLSurface::InitializeOneOff()) { 82 if (!gfx::GLSurface::InitializeOneOff()) {
83 LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed"; 83 LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed";
84 return false; 84 return false;
85 } 85 }
86 86
87 scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface()); 87 scoped_refptr<gfx::GLSurface> surface(InitializeGLSurface());
88 if (!surface.get()) 88 if (!surface)
89 return false; 89 return false;
90 90
91 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get())); 91 scoped_refptr<gfx::GLContext> context(InitializeGLContext(surface.get()));
92 if (!context.get()) 92 if (!context)
93 return false; 93 return false;
94 94
95 gpu_info->gl_renderer = GetGLString(GL_RENDERER); 95 gpu_info->gl_renderer = GetGLString(GL_RENDERER);
96 gpu_info->gl_vendor = GetGLString(GL_VENDOR); 96 gpu_info->gl_vendor = GetGLString(GL_VENDOR);
97 gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS); 97 gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS);
98 gpu_info->gl_version_string = GetGLString(GL_VERSION); 98 gpu_info->gl_version_string = GetGLString(GL_VERSION);
99 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); 99 std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION);
100 // TODO(kbr): remove once the destruction of a current context automatically 100 // TODO(kbr): remove once the destruction of a current context automatically
101 // clears the current context. 101 // clears the current context.
102 context->ReleaseCurrent(surface.get()); 102 context->ReleaseCurrent(surface.get());
(...skipping 26 matching lines...) Expand all
129 129
130 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; 130 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context;
131 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; 131 basic_gpu_info->sandboxed = context_gpu_info.sandboxed;
132 basic_gpu_info->gpu_accessible = context_gpu_info.gpu_accessible; 132 basic_gpu_info->gpu_accessible = context_gpu_info.gpu_accessible;
133 basic_gpu_info->finalized = context_gpu_info.finalized; 133 basic_gpu_info->finalized = context_gpu_info.finalized;
134 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; 134 basic_gpu_info->initialization_time = context_gpu_info.initialization_time;
135 } 135 }
136 136
137 } // namespace gpu_info_collector 137 } // namespace gpu_info_collector
138 138
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698