OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/debug/trace_event.h" | |
9 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_idle.h" | |
10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_share_group.h
" | |
11 #include "gpu/command_buffer/service/async_pixel_transfer_delegate_stub.h" | |
12 #include "gpu/command_buffer/service/gpu_switches.h" | |
13 #include "ui/gl/gl_implementation.h" | |
14 | |
15 namespace gpu { | |
16 | |
17 AsyncPixelTransferDelegate* AsyncPixelTransferDelegate::Create( | |
18 gfx::GLContext* context) { | |
19 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
20 switches::kEnableShareGroupAsyncTextureUpload)) { | |
21 DCHECK(context); | |
22 return static_cast<AsyncPixelTransferDelegate*> ( | |
23 new AsyncPixelTransferDelegateShareGroup(context)); | |
24 } | |
25 | |
26 TRACE_EVENT0("gpu", "AsyncPixelTransferDelegate::Create"); | |
27 switch (gfx::GetGLImplementation()) { | |
28 case gfx::kGLImplementationOSMesaGL: | |
29 case gfx::kGLImplementationDesktopGL: | |
30 case gfx::kGLImplementationEGLGLES2: | |
31 return new AsyncPixelTransferDelegateIdle; | |
32 case gfx::kGLImplementationMockGL: | |
33 return new AsyncPixelTransferDelegateStub; | |
34 default: | |
35 NOTREACHED(); | |
36 return NULL; | |
37 } | |
38 } | |
39 | |
40 } // namespace gpu | |
OLD | NEW |