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 "gpu/command_buffer/client/gl_in_process_context.h" | 5 #include "gpu/command_buffer/client/gl_in_process_context.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 window, | 330 window, |
331 size, | 331 size, |
332 attribs, | 332 attribs, |
333 gpu_preference, | 333 gpu_preference, |
334 scoped_refptr<InProcessCommandBuffer::Service>())) | 334 scoped_refptr<InProcessCommandBuffer::Service>())) |
335 return NULL; | 335 return NULL; |
336 | 336 |
337 return context.release(); | 337 return context.release(); |
338 } | 338 } |
339 | 339 |
340 // static | 340 GLInProcessContext* GLInProcessContext::Create( |
341 GLInProcessContext* GLInProcessContext::CreateWithSurface( | 341 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
342 scoped_refptr<gfx::GLSurface> surface, | 342 scoped_refptr<gfx::GLSurface> surface, |
343 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 343 bool is_offscreen, |
| 344 gfx::AcceleratedWidget window, |
| 345 const gfx::Size& size, |
344 GLInProcessContext* share_context, | 346 GLInProcessContext* share_context, |
| 347 bool use_global_share_group, |
345 const GLInProcessContextAttribs& attribs, | 348 const GLInProcessContextAttribs& attribs, |
346 gfx::GpuPreference gpu_preference) { | 349 gfx::GpuPreference gpu_preference) { |
347 scoped_ptr<GLInProcessContextImpl> context( | 350 DCHECK(!use_global_share_group || !share_context); |
348 new GLInProcessContextImpl()); | 351 if (surface.get()) { |
349 if (!context->Initialize( | 352 DCHECK_EQ(surface->IsOffscreen(), is_offscreen); |
350 surface, | 353 DCHECK(surface->GetSize() == size); |
351 surface->IsOffscreen(), | 354 DCHECK_EQ(gfx::kNullAcceleratedWidget, window); |
352 false, | 355 } |
353 share_context, | 356 |
354 gfx::kNullAcceleratedWidget, | 357 scoped_ptr<GLInProcessContextImpl> context(new GLInProcessContextImpl()); |
355 surface->GetSize(), | 358 if (!context->Initialize(surface, |
356 attribs, | 359 is_offscreen, |
357 gpu_preference, | 360 use_global_share_group, |
358 service)) | 361 share_context, |
| 362 gfx::kNullAcceleratedWidget, |
| 363 size, |
| 364 attribs, |
| 365 gpu_preference, |
| 366 service)) |
359 return NULL; | 367 return NULL; |
360 | 368 |
361 return context.release(); | 369 return context.release(); |
362 } | 370 } |
363 | 371 |
364 } // namespace gpu | 372 } // namespace gpu |
OLD | NEW |