OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/service/gpu_scheduler.h" | 5 #include "gpu/command_buffer/service/gpu_scheduler.h" |
6 #include "ui/gfx/gl/gl_context.h" | 6 #include "ui/gfx/gl/gl_context.h" |
7 #include "ui/gfx/gl/gl_surface.h" | 7 #include "ui/gfx/gl/gl_surface.h" |
8 | 8 |
9 using ::base::SharedMemory; | 9 using ::base::SharedMemory; |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 if (!surface.get()) { | 43 if (!surface.get()) { |
44 LOG(ERROR) << "GpuScheduler::Initialize failed.\n"; | 44 LOG(ERROR) << "GpuScheduler::Initialize failed.\n"; |
45 Destroy(); | 45 Destroy(); |
46 return false; | 46 return false; |
47 } | 47 } |
48 | 48 |
49 // Create a GLContext and attach the surface. | 49 // Create a GLContext and attach the surface. |
50 scoped_ptr<gfx::GLContext> context( | 50 scoped_ptr<gfx::GLContext> context( |
51 gfx::GLContext::CreateGLContext(surface.release(), parent_context)); | 51 gfx::GLContext::CreateGLContext(parent_context, surface.get())); |
52 if (!context.get()) { | 52 if (!context.get()) { |
53 LOG(ERROR) << "CreateGLContext failed.\n"; | 53 LOG(ERROR) << "CreateGLContext failed.\n"; |
54 Destroy(); | 54 Destroy(); |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 return InitializeCommon(context.release(), | 58 return InitializeCommon(surface.release(), |
| 59 context.release(), |
59 size, | 60 size, |
60 disallowed_extensions, | 61 disallowed_extensions, |
61 allowed_extensions, | 62 allowed_extensions, |
62 attribs, | 63 attribs, |
63 parent_decoder, | 64 parent_decoder, |
64 parent_texture_id); | 65 parent_texture_id); |
65 } | 66 } |
66 | 67 |
67 void GpuScheduler::Destroy() { | 68 void GpuScheduler::Destroy() { |
68 DestroyCommon(); | 69 DestroyCommon(); |
69 } | 70 } |
70 | 71 |
71 void GpuScheduler::WillSwapBuffers() { | 72 void GpuScheduler::WillSwapBuffers() { |
72 if (wrapped_swap_buffers_callback_.get()) { | 73 if (wrapped_swap_buffers_callback_.get()) { |
73 wrapped_swap_buffers_callback_->Run(); | 74 wrapped_swap_buffers_callback_->Run(); |
74 } | 75 } |
75 } | 76 } |
76 | 77 |
77 } // namespace gpu | 78 } // namespace gpu |
OLD | NEW |