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

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 1251783002: Mac Overlays: Wire up overlays on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@part22
Patch Set: Leave disabled for now Created 5 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_ozone.h" 57 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida tor_ozone.h"
58 #include "content/browser/compositor/software_output_device_ozone.h" 58 #include "content/browser/compositor/software_output_device_ozone.h"
59 #include "ui/ozone/public/overlay_candidates_ozone.h" 59 #include "ui/ozone/public/overlay_candidates_ozone.h"
60 #include "ui/ozone/public/overlay_manager_ozone.h" 60 #include "ui/ozone/public/overlay_manager_ozone.h"
61 #include "ui/ozone/public/ozone_platform.h" 61 #include "ui/ozone/public/ozone_platform.h"
62 #include "ui/ozone/public/ozone_switches.h" 62 #include "ui/ozone/public/ozone_switches.h"
63 #elif defined(USE_X11) 63 #elif defined(USE_X11)
64 #include "content/browser/compositor/software_output_device_x11.h" 64 #include "content/browser/compositor/software_output_device_x11.h"
65 #elif defined(OS_MACOSX) 65 #elif defined(OS_MACOSX)
66 #include "content/browser/compositor/software_output_device_mac.h" 66 #include "content/browser/compositor/software_output_device_mac.h"
67 #include "ui/base/cocoa/remote_layer_api.h"
67 #endif 68 #endif
68 69
69 using cc::ContextProvider; 70 using cc::ContextProvider;
70 using gpu::gles2::GLES2Interface; 71 using gpu::gles2::GLES2Interface;
71 72
72 static const int kNumRetriesBeforeSoftwareFallback = 4; 73 static const int kNumRetriesBeforeSoftwareFallback = 4;
73 74
74 namespace content { 75 namespace content {
75 namespace { 76 namespace {
76 77
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 compositor->vsync_manager())); 271 compositor->vsync_manager()));
271 } else { 272 } else {
272 DCHECK(context_provider); 273 DCHECK(context_provider);
273 ContextProvider::Capabilities capabilities = 274 ContextProvider::Capabilities capabilities =
274 context_provider->ContextCapabilities(); 275 context_provider->ContextCapabilities();
275 if (!data->surface_id) { 276 if (!data->surface_id) {
276 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( 277 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface(
277 context_provider, compositor->vsync_manager(), 278 context_provider, compositor->vsync_manager(),
278 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); 279 scoped_ptr<BrowserCompositorOverlayCandidateValidator>()));
279 } else if (capabilities.gpu.surfaceless) { 280 } else if (capabilities.gpu.surfaceless) {
281 GLenum target = GL_TEXTURE_2D;
282 GLenum format = GL_RGB;
283 #if defined(OS_MACOSX)
284 target = GL_TEXTURE_RECTANGLE_ARB;
285 format = GL_BGRA_EXT;
286 #endif
280 surface = 287 surface =
281 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( 288 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface(
282 context_provider, data->surface_id, compositor->vsync_manager(), 289 context_provider, data->surface_id, compositor->vsync_manager(),
283 CreateOverlayCandidateValidator(compositor->widget()), 290 CreateOverlayCandidateValidator(compositor->widget()), target,
284 GL_TEXTURE_2D, GL_RGB, BrowserGpuMemoryBufferManager::current())); 291 format, BrowserGpuMemoryBufferManager::current()));
285 } else { 292 } else {
286 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( 293 if (!surface) {
287 context_provider, compositor->vsync_manager(), 294 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface(
288 CreateOverlayCandidateValidator(compositor->widget()))); 295 context_provider, compositor->vsync_manager(),
296 CreateOverlayCandidateValidator(compositor->widget())));
297 }
289 } 298 }
290 } 299 }
291 300
292 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an 301 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an
293 // output_surface_map_ here. 302 // output_surface_map_ here.
294 output_surface_map_.AddWithID(surface.get(), data->surface_id); 303 output_surface_map_.AddWithID(surface.get(), data->surface_id);
295 data->surface = surface.get(); 304 data->surface = surface.get();
296 if (data->reflector) 305 if (data->reflector)
297 data->reflector->OnSourceSurfaceReady(data->surface); 306 data->reflector->OnSourceSurfaceReady(data->surface);
298 307
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 596 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
588 observer_list_, 597 observer_list_,
589 OnLostResources()); 598 OnLostResources());
590 599
591 // Kill things that use the shared context before killing the shared context. 600 // Kill things that use the shared context before killing the shared context.
592 lost_gl_helper.reset(); 601 lost_gl_helper.reset();
593 lost_shared_main_thread_contexts = NULL; 602 lost_shared_main_thread_contexts = NULL;
594 } 603 }
595 604
596 } // namespace content 605 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698