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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 1144333004: Make WebView work for external displays (over Presentations). Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix another context-use through making WindowAndroid::GetJavaContext public 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 (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 "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 new cc::SurfaceIdAllocator(++g_surface_id_namespace)); 211 new cc::SurfaceIdAllocator(++g_surface_id_namespace));
212 cc::SurfaceManager* manager = GetSurfaceManager(); 212 cc::SurfaceManager* manager = GetSurfaceManager();
213 DCHECK(manager); 213 DCHECK(manager);
214 allocator->RegisterSurfaceIdNamespace(manager); 214 allocator->RegisterSurfaceIdNamespace(manager);
215 return allocator.Pass(); 215 return allocator.Pass();
216 } 216 }
217 217
218 CompositorImpl::CompositorImpl(CompositorClient* client, 218 CompositorImpl::CompositorImpl(CompositorClient* client,
219 gfx::NativeWindow root_window) 219 gfx::NativeWindow root_window)
220 : root_layer_(cc::Layer::Create(Compositor::LayerSettings())), 220 : root_layer_(cc::Layer::Create(Compositor::LayerSettings())),
221 resource_manager_(&ui_resource_provider_), 221 resource_manager_(&ui_resource_provider_,
222 root_window->GetJavaContext().obj()),
222 surface_id_allocator_(GetSurfaceManager() ? CreateSurfaceIdAllocator() 223 surface_id_allocator_(GetSurfaceManager() ? CreateSurfaceIdAllocator()
223 : nullptr), 224 : nullptr),
224 has_transparent_background_(false), 225 has_transparent_background_(false),
225 device_scale_factor_(1), 226 device_scale_factor_(1),
226 window_(NULL), 227 window_(NULL),
227 surface_id_(0), 228 surface_id_(0),
228 client_(client), 229 client_(client),
229 root_window_(root_window), 230 root_window_(root_window),
230 did_post_swapbuffers_(false), 231 did_post_swapbuffers_(false),
231 ignore_schedule_composite_(false), 232 ignore_schedule_composite_(false),
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 DCHECK(!needs_composite_ || WillComposite()); 537 DCHECK(!needs_composite_ || WillComposite());
537 538
538 needs_composite_ = true; 539 needs_composite_ = true;
539 PostComposite(COMPOSITE_IMMEDIATELY); 540 PostComposite(COMPOSITE_IMMEDIATELY);
540 } 541 }
541 542
542 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 543 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
543 CreateGpuProcessViewContext( 544 CreateGpuProcessViewContext(
544 const scoped_refptr<GpuChannelHost>& gpu_channel_host, 545 const scoped_refptr<GpuChannelHost>& gpu_channel_host,
545 const blink::WebGraphicsContext3D::Attributes attributes, 546 const blink::WebGraphicsContext3D::Attributes attributes,
546 int surface_id) { 547 int surface_id,
548 gfx::NativeWindow nativeWindow) {
jdduke (slow) 2015/07/15 16:03:07 Hmm, what about passing it in as "const ui::Window
547 GURL url("chrome://gpu/Compositor::createContext3D"); 549 GURL url("chrome://gpu/Compositor::createContext3D");
548 static const size_t kBytesPerPixel = 4; 550 static const size_t kBytesPerPixel = 4;
549 gfx::DeviceDisplayInfo display_info; 551 const gfx::DeviceDisplayInfo& display_info =
552 nativeWindow->GetDeviceDisplayInfo();
550 size_t full_screen_texture_size_in_bytes = 553 size_t full_screen_texture_size_in_bytes =
551 display_info.GetDisplayHeight() * 554 display_info.GetDisplayHeight() *
552 display_info.GetDisplayWidth() * 555 display_info.GetDisplayWidth() *
553 kBytesPerPixel; 556 kBytesPerPixel;
554 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 557 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
555 limits.command_buffer_size = 64 * 1024; 558 limits.command_buffer_size = 64 * 1024;
556 limits.start_transfer_buffer_size = 64 * 1024; 559 limits.start_transfer_buffer_size = 64 * 1024;
557 limits.min_transfer_buffer_size = 64 * 1024; 560 limits.min_transfer_buffer_size = 64 * 1024;
558 limits.max_transfer_buffer_size = std::min( 561 limits.max_transfer_buffer_size = std::min(
559 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); 562 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 640
638 BrowserGpuChannelHostFactory* factory = 641 BrowserGpuChannelHostFactory* factory =
639 BrowserGpuChannelHostFactory::instance(); 642 BrowserGpuChannelHostFactory::instance();
640 // This channel might be lost (and even if it isn't right now, it might 643 // This channel might be lost (and even if it isn't right now, it might
641 // still get marked as lost from the IO thread, at any point in time really). 644 // still get marked as lost from the IO thread, at any point in time really).
642 // But from here on just try and always lead to either 645 // But from here on just try and always lead to either
643 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). 646 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface().
644 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 647 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
645 scoped_refptr<ContextProviderCommandBuffer> context_provider( 648 scoped_refptr<ContextProviderCommandBuffer> context_provider(
646 ContextProviderCommandBuffer::Create( 649 ContextProviderCommandBuffer::Create(
647 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), 650 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_,
651 root_window_),
648 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); 652 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT));
649 DCHECK(context_provider.get()); 653 DCHECK(context_provider.get());
650 654
651 scoped_ptr<cc::OutputSurface> real_output_surface( 655 scoped_ptr<cc::OutputSurface> real_output_surface(
652 new OutputSurfaceWithoutParent( 656 new OutputSurfaceWithoutParent(
653 context_provider, base::Bind(&CompositorImpl::PopulateGpuCapabilities, 657 context_provider, base::Bind(&CompositorImpl::PopulateGpuCapabilities,
654 base::Unretained(this)))); 658 base::Unretained(this))));
655 659
656 cc::SurfaceManager* manager = GetSurfaceManager(); 660 cc::SurfaceManager* manager = GetSurfaceManager();
657 if (manager) { 661 if (manager) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 767
764 void CompositorImpl::SetNeedsAnimate() { 768 void CompositorImpl::SetNeedsAnimate() {
765 needs_animate_ = true; 769 needs_animate_ = true;
766 if (!host_) 770 if (!host_)
767 return; 771 return;
768 772
769 host_->SetNeedsAnimate(); 773 host_->SetNeedsAnimate();
770 } 774 }
771 775
772 } // namespace content 776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698