| 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/demos/framework/window.h" | 5 #include "gpu/demos/framework/window.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "gpu/command_buffer/client/gles2_implementation.h" | 8 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 9 #include "gpu/command_buffer/client/gles2_lib.h" | 9 #include "gpu/command_buffer/client/gles2_lib.h" |
| 10 #include "gpu/command_buffer/service/command_buffer_service.h" | 10 #include "gpu/command_buffer/service/command_buffer_service.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // TODO(apatrick): It looks like all the resources allocated here leak. We | 53 // TODO(apatrick): It looks like all the resources allocated here leak. We |
| 54 // should fix that if we want to use this Window class for anything beyond this | 54 // should fix that if we want to use this Window class for anything beyond this |
| 55 // simple use case. | 55 // simple use case. |
| 56 bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { | 56 bool Window::CreateRenderContext(gfx::PluginWindowHandle hwnd) { |
| 57 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); | 57 scoped_ptr<CommandBufferService> command_buffer(new CommandBufferService); |
| 58 if (!command_buffer->Initialize(kCommandBufferSize)) { | 58 if (!command_buffer->Initialize(kCommandBufferSize)) { |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 GpuScheduler* gpu_scheduler( | 62 GpuScheduler* gpu_scheduler( |
| 63 GpuScheduler::Create(command_buffer.get(), | 63 new GpuScheduler(command_buffer.get(), NULL, NULL)); |
| 64 NULL, | |
| 65 NULL)); | |
| 66 if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), | 64 if (!gpu_scheduler->Initialize(hwnd, gfx::Size(), |
| 67 gpu::gles2::DisallowedExtensions(), | 65 gpu::gles2::DisallowedExtensions(), |
| 68 NULL, std::vector<int32>(), | 66 NULL, std::vector<int32>(), |
| 69 NULL)) { | 67 NULL)) { |
| 70 return false; | 68 return false; |
| 71 } | 69 } |
| 72 | 70 |
| 73 command_buffer->SetPutOffsetChangeCallback( | 71 command_buffer->SetPutOffsetChangeCallback( |
| 74 NewCallback(gpu_scheduler, &GpuScheduler::PutChanged)); | 72 NewCallback(gpu_scheduler, &GpuScheduler::PutChanged)); |
| 75 | 73 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 ::gles2::SetGLContext(new GLES2Implementation(helper, | 87 ::gles2::SetGLContext(new GLES2Implementation(helper, |
| 90 transfer_buffer.size, | 88 transfer_buffer.size, |
| 91 transfer_buffer.ptr, | 89 transfer_buffer.ptr, |
| 92 transfer_buffer_id, | 90 transfer_buffer_id, |
| 93 false)); | 91 false)); |
| 94 return command_buffer.release() != NULL; | 92 return command_buffer.release() != NULL; |
| 95 } | 93 } |
| 96 | 94 |
| 97 } // namespace demos | 95 } // namespace demos |
| 98 } // namespace gpu | 96 } // namespace gpu |
| OLD | NEW |