OLD | NEW |
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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 return 0; | 270 return 0; |
271 } | 271 } |
272 | 272 |
273 namespace { | 273 namespace { |
274 | 274 |
275 #if defined(OS_LINUX) | 275 #if defined(OS_LINUX) |
276 void CreateDummyGlContext() { | 276 void CreateDummyGlContext() { |
277 scoped_refptr<gfx::GLSurface> surface( | 277 scoped_refptr<gfx::GLSurface> surface( |
278 gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1))); | 278 gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1))); |
279 if (!surface) { | 279 if (!surface.get()) { |
280 VLOG(1) << "gfx::GLSurface::CreateOffscreenGLSurface failed"; | 280 VLOG(1) << "gfx::GLSurface::CreateOffscreenGLSurface failed"; |
281 return; | 281 return; |
282 } | 282 } |
283 | 283 |
284 // On Linux, this is needed to make sure /dev/nvidiactl has | 284 // On Linux, this is needed to make sure /dev/nvidiactl has |
285 // been opened and its descriptor cached. | 285 // been opened and its descriptor cached. |
286 scoped_refptr<gfx::GLContext> context( | 286 scoped_refptr<gfx::GLContext> context(gfx::GLContext::CreateGLContext( |
287 gfx::GLContext::CreateGLContext(NULL, | 287 NULL, surface.get(), gfx::PreferDiscreteGpu)); |
288 surface, | 288 if (!context.get()) { |
289 gfx::PreferDiscreteGpu)); | |
290 if (!context) { | |
291 VLOG(1) << "gfx::GLContext::CreateGLContext failed"; | 289 VLOG(1) << "gfx::GLContext::CreateGLContext failed"; |
292 return; | 290 return; |
293 } | 291 } |
294 | 292 |
295 // Similarly, this is needed for /dev/nvidia0. | 293 // Similarly, this is needed for /dev/nvidia0. |
296 if (context->MakeCurrent(surface)) { | 294 if (context->MakeCurrent(surface.get())) { |
297 context->ReleaseCurrent(surface.get()); | 295 context->ReleaseCurrent(surface.get()); |
298 } else { | 296 } else { |
299 VLOG(1) << "gfx::GLContext::MakeCurrent failed"; | 297 VLOG(1) << "gfx::GLContext::MakeCurrent failed"; |
300 } | 298 } |
301 } | 299 } |
302 #endif | 300 #endif |
303 | 301 |
304 void WarmUpSandbox() { | 302 void WarmUpSandbox() { |
305 { | 303 { |
306 TRACE_EVENT0("gpu", "Warm up rand"); | 304 TRACE_EVENT0("gpu", "Warm up rand"); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return true; | 387 return true; |
390 } | 388 } |
391 | 389 |
392 return false; | 390 return false; |
393 } | 391 } |
394 #endif // defined(OS_WIN) | 392 #endif // defined(OS_WIN) |
395 | 393 |
396 } // namespace. | 394 } // namespace. |
397 | 395 |
398 } // namespace content | 396 } // namespace content |
OLD | NEW |