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/ipc/service/gpu_command_buffer_stub.h" | 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 if (!surface_ || !surface_->Initialize(surface_format)) { | 528 if (!surface_ || !surface_->Initialize(surface_format)) { |
529 surface_ = nullptr; | 529 surface_ = nullptr; |
530 DLOG(ERROR) << "Failed to create surface."; | 530 DLOG(ERROR) << "Failed to create surface."; |
531 return false; | 531 return false; |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 scoped_refptr<gl::GLContext> context; | 535 scoped_refptr<gl::GLContext> context; |
536 gl::GLShareGroup* gl_share_group = channel_->share_group(); | 536 gl::GLShareGroup* gl_share_group = channel_->share_group(); |
537 if (use_virtualized_gl_context_ && gl_share_group) { | 537 if (use_virtualized_gl_context_ && gl_share_group) { |
538 context = gl_share_group->GetSharedContext(); | 538 context = gl_share_group->GetSharedContext(surface_.get()); |
539 if (!context.get()) { | 539 if (!context.get()) { |
540 context = gl::init::CreateGLContext(gl_share_group, default_surface, | 540 context = gl::init::CreateGLContext(gl_share_group, surface_.get(), |
541 init_params.attribs.gpu_preference); | 541 init_params.attribs.gpu_preference); |
542 if (!context.get()) { | 542 if (!context.get()) { |
543 DLOG(ERROR) << "Failed to create shared context for virtualization."; | 543 DLOG(ERROR) << "Failed to create shared context for virtualization."; |
544 return false; | 544 return false; |
545 } | 545 } |
546 // Ensure that context creation did not lose track of the intended | 546 // Ensure that context creation did not lose track of the intended |
547 // gl_share_group. | 547 // gl_share_group. |
548 DCHECK(context->share_group() == gl_share_group); | 548 DCHECK(context->share_group() == gl_share_group); |
549 gl_share_group->SetSharedContext(context.get()); | 549 gl_share_group->SetSharedContext(surface_.get(), context.get()); |
550 } | 550 } |
551 // This should be either: | 551 // This should be either: |
552 // (1) a non-virtual GL context, or | 552 // (1) a non-virtual GL context, or |
553 // (2) a mock context. | 553 // (2) a mock context. |
554 DCHECK(context->GetHandle() || | 554 DCHECK(context->GetHandle() || |
555 gl::GetGLImplementation() == gl::kGLImplementationMockGL); | 555 gl::GetGLImplementation() == gl::kGLImplementationMockGL); |
556 context = new GLContextVirtual( | 556 context = new GLContextVirtual( |
557 gl_share_group, context.get(), decoder_->AsWeakPtr()); | 557 gl_share_group, context.get(), decoder_->AsWeakPtr()); |
558 if (!context->Initialize(surface_.get(), | 558 if (!context->Initialize(surface_.get(), |
559 init_params.attribs.gpu_preference)) { | 559 init_params.attribs.gpu_preference)) { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); | 1113 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); |
1114 } | 1114 } |
1115 | 1115 |
1116 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1116 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1117 base::TimeDelta interval) { | 1117 base::TimeDelta interval) { |
1118 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1118 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1119 interval)); | 1119 interval)); |
1120 } | 1120 } |
1121 | 1121 |
1122 } // namespace gpu | 1122 } // namespace gpu |
OLD | NEW |