OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 virtual void OnAcceleratedWidgetAvailable( | 79 virtual void OnAcceleratedWidgetAvailable( |
80 gfx::AcceleratedWidget widget) OVERRIDE { | 80 gfx::AcceleratedWidget widget) OVERRIDE { |
81 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); | 81 DCHECK_NE(widget, gfx::kNullAcceleratedWidget); |
82 widget_ = widget; | 82 widget_ = widget; |
83 } | 83 } |
84 virtual void OnActivationChanged(bool active) OVERRIDE {} | 84 virtual void OnActivationChanged(bool active) OVERRIDE {} |
85 | 85 |
86 private: | 86 private: |
87 bool InitializeGLSurface() { | 87 bool InitializeGLSurface() { |
88 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); | 88 surface_ = gfx::GLSurface::CreateViewGLSurface(GetAcceleratedWidget()); |
89 if (!surface_) { | 89 if (!surface_.get()) { |
90 LOG(ERROR) << "Failed to create GL surface"; | 90 LOG(ERROR) << "Failed to create GL surface"; |
91 return false; | 91 return false; |
92 } | 92 } |
93 | 93 |
94 context_ = gfx::GLContext::CreateGLContext( | 94 context_ = gfx::GLContext::CreateGLContext( |
95 NULL, surface_.get(), gfx::PreferIntegratedGpu); | 95 NULL, surface_.get(), gfx::PreferIntegratedGpu); |
96 if (!context_) { | 96 if (!context_.get()) { |
97 LOG(ERROR) << "Failed to create GL context"; | 97 LOG(ERROR) << "Failed to create GL context"; |
98 surface_ = NULL; | 98 surface_ = NULL; |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 surface_->Resize(GetSize()); | 102 surface_->Resize(GetSize()); |
103 | 103 |
104 if (!context_->MakeCurrent(surface_.get())) { | 104 if (!context_->MakeCurrent(surface_.get())) { |
105 LOG(ERROR) << "Failed to make GL context current"; | 105 LOG(ERROR) << "Failed to make GL context current"; |
106 surface_ = NULL; | 106 surface_ = NULL; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 DemoWindow* window = new DemoWindow; | 213 DemoWindow* window = new DemoWindow; |
214 window->Start(); | 214 window->Start(); |
215 | 215 |
216 // Run the message loop until there's nothing left to do. | 216 // Run the message loop until there's nothing left to do. |
217 // TODO(spang): Should we use QuitClosure instead? | 217 // TODO(spang): Should we use QuitClosure instead? |
218 base::RunLoop run_loop; | 218 base::RunLoop run_loop; |
219 run_loop.RunUntilIdle(); | 219 run_loop.RunUntilIdle(); |
220 | 220 |
221 return 0; | 221 return 0; |
222 } | 222 } |
OLD | NEW |