Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 1930633002: Fix gpu_ipc_service_unittests on mac_chromium_rel_ng by managing GL shared groups the same way in s… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gl/gl_context_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "gpu/ipc/common/gpu_messages.h" 32 #include "gpu/ipc/common/gpu_messages.h"
33 #include "gpu/ipc/service/gpu_channel.h" 33 #include "gpu/ipc/service/gpu_channel.h"
34 #include "gpu/ipc/service/gpu_channel_manager.h" 34 #include "gpu/ipc/service/gpu_channel_manager.h"
35 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" 35 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
36 #include "gpu/ipc/service/gpu_memory_manager.h" 36 #include "gpu/ipc/service/gpu_memory_manager.h"
37 #include "gpu/ipc/service/gpu_memory_tracking.h" 37 #include "gpu/ipc/service/gpu_memory_tracking.h"
38 #include "gpu/ipc/service/gpu_watchdog.h" 38 #include "gpu/ipc/service/gpu_watchdog.h"
39 #include "gpu/ipc/service/image_transport_surface.h" 39 #include "gpu/ipc/service/image_transport_surface.h"
40 #include "ui/gl/gl_bindings.h" 40 #include "ui/gl/gl_bindings.h"
41 #include "ui/gl/gl_image.h" 41 #include "ui/gl/gl_image.h"
42 #include "ui/gl/gl_implementation.h"
42 #include "ui/gl/gl_switches.h" 43 #include "ui/gl/gl_switches.h"
43 44
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 #include "base/win/win_util.h" 46 #include "base/win/win_util.h"
46 #endif 47 #endif
47 48
48 #if defined(OS_ANDROID) 49 #if defined(OS_ANDROID)
49 #include "gpu/ipc/service/stream_texture_android.h" 50 #include "gpu/ipc/service/stream_texture_android.h"
50 #endif 51 #endif
51 52
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 OnInitializeFailed(reply_message); 557 OnInitializeFailed(reply_message);
557 return; 558 return;
558 } 559 }
559 560
560 scoped_refptr<gfx::GLContext> context; 561 scoped_refptr<gfx::GLContext> context;
561 gfx::GLShareGroup* share_group = channel_->share_group(); 562 gfx::GLShareGroup* share_group = channel_->share_group();
562 if (use_virtualized_gl_context_ && share_group) { 563 if (use_virtualized_gl_context_ && share_group) {
563 context = share_group->GetSharedContext(); 564 context = share_group->GetSharedContext();
564 if (!context.get()) { 565 if (!context.get()) {
565 context = gfx::GLContext::CreateGLContext( 566 context = gfx::GLContext::CreateGLContext(
566 channel_->share_group(), 567 share_group,
567 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), 568 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(),
568 gpu_preference_); 569 gpu_preference_);
569 if (!context.get()) { 570 if (!context.get()) {
570 DLOG(ERROR) << "Failed to create shared context for virtualization."; 571 DLOG(ERROR) << "Failed to create shared context for virtualization.";
571 OnInitializeFailed(reply_message); 572 OnInitializeFailed(reply_message);
572 return; 573 return;
573 } 574 }
574 channel_->share_group()->SetSharedContext(context.get()); 575 // Ensure that context creation did not lose track of the intended
576 // share_group.
577 DCHECK(context->share_group() == share_group);
578 share_group->SetSharedContext(context.get());
575 } 579 }
576 // This should be a non-virtual GL context. 580 // This should be either:
577 DCHECK(context->GetHandle()); 581 // (1) a non-virtual GL context, or
582 // (2) a mock context.
583 DCHECK(context->GetHandle() ||
584 gfx::GetGLImplementation() == gfx::kGLImplementationMockGL);
578 context = new GLContextVirtual( 585 context = new GLContextVirtual(
579 share_group, context.get(), decoder_->AsWeakPtr()); 586 share_group, context.get(), decoder_->AsWeakPtr());
580 if (!context->Initialize(surface_.get(), gpu_preference_)) { 587 if (!context->Initialize(surface_.get(), gpu_preference_)) {
581 // The real context created above for the default offscreen surface 588 // The real context created above for the default offscreen surface
582 // might not be compatible with this surface. 589 // might not be compatible with this surface.
583 context = NULL; 590 context = NULL;
584 591
585 DLOG(ERROR) << "Failed to initialize virtual GL context."; 592 DLOG(ERROR) << "Failed to initialize virtual GL context.";
586 OnInitializeFailed(reply_message); 593 OnInitializeFailed(reply_message);
587 return; 594 return;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 result)); 1133 result));
1127 } 1134 }
1128 1135
1129 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1136 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1130 base::TimeDelta interval) { 1137 base::TimeDelta interval) {
1131 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1138 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1132 interval)); 1139 interval));
1133 } 1140 }
1134 1141
1135 } // namespace gpu 1142 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_context_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698