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

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: Created 5 years, 6 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 DCHECK(!needs_composite_ || WillComposite()); 522 DCHECK(!needs_composite_ || WillComposite());
523 523
524 needs_composite_ = true; 524 needs_composite_ = true;
525 PostComposite(COMPOSITE_IMMEDIATELY); 525 PostComposite(COMPOSITE_IMMEDIATELY);
526 } 526 }
527 527
528 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 528 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
529 CreateGpuProcessViewContext( 529 CreateGpuProcessViewContext(
530 const scoped_refptr<GpuChannelHost>& gpu_channel_host, 530 const scoped_refptr<GpuChannelHost>& gpu_channel_host,
531 const blink::WebGraphicsContext3D::Attributes attributes, 531 const blink::WebGraphicsContext3D::Attributes attributes,
532 int surface_id) { 532 int surface_id,
533 gfx::NativeWindow nativeWindow) {
533 GURL url("chrome://gpu/Compositor::createContext3D"); 534 GURL url("chrome://gpu/Compositor::createContext3D");
534 static const size_t kBytesPerPixel = 4; 535 static const size_t kBytesPerPixel = 4;
535 gfx::DeviceDisplayInfo display_info; 536 gfx::DeviceDisplayInfo display_info(nativeWindow->GetJavaObject().obj());
536 size_t full_screen_texture_size_in_bytes = 537 size_t full_screen_texture_size_in_bytes =
537 display_info.GetDisplayHeight() * 538 display_info.GetDisplayHeight() *
538 display_info.GetDisplayWidth() * 539 display_info.GetDisplayWidth() *
539 kBytesPerPixel; 540 kBytesPerPixel;
540 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 541 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
541 limits.command_buffer_size = 64 * 1024; 542 limits.command_buffer_size = 64 * 1024;
542 limits.start_transfer_buffer_size = 64 * 1024; 543 limits.start_transfer_buffer_size = 64 * 1024;
543 limits.min_transfer_buffer_size = 64 * 1024; 544 limits.min_transfer_buffer_size = 64 * 1024;
544 limits.max_transfer_buffer_size = std::min( 545 limits.max_transfer_buffer_size = std::min(
545 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); 546 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 624
624 BrowserGpuChannelHostFactory* factory = 625 BrowserGpuChannelHostFactory* factory =
625 BrowserGpuChannelHostFactory::instance(); 626 BrowserGpuChannelHostFactory::instance();
626 // This channel might be lost (and even if it isn't right now, it might 627 // This channel might be lost (and even if it isn't right now, it might
627 // still get marked as lost from the IO thread, at any point in time really). 628 // still get marked as lost from the IO thread, at any point in time really).
628 // But from here on just try and always lead to either 629 // But from here on just try and always lead to either
629 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). 630 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface().
630 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 631 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
631 scoped_refptr<ContextProviderCommandBuffer> context_provider( 632 scoped_refptr<ContextProviderCommandBuffer> context_provider(
632 ContextProviderCommandBuffer::Create( 633 ContextProviderCommandBuffer::Create(
633 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), 634 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_,
635 root_window_),
634 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); 636 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT));
635 DCHECK(context_provider.get()); 637 DCHECK(context_provider.get());
636 638
637 scoped_ptr<cc::OutputSurface> real_output_surface( 639 scoped_ptr<cc::OutputSurface> real_output_surface(
638 new OutputSurfaceWithoutParent(context_provider, 640 new OutputSurfaceWithoutParent(context_provider,
639 weak_factory_.GetWeakPtr())); 641 weak_factory_.GetWeakPtr()));
640 642
641 cc::SurfaceManager* manager = GetSurfaceManager(); 643 cc::SurfaceManager* manager = GetSurfaceManager();
642 if (manager) { 644 if (manager) {
643 display_client_.reset(new cc::OnscreenDisplayClient( 645 display_client_.reset(new cc::OnscreenDisplayClient(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 750
749 void CompositorImpl::SetNeedsAnimate() { 751 void CompositorImpl::SetNeedsAnimate() {
750 needs_animate_ = true; 752 needs_animate_ = true;
751 if (!host_) 753 if (!host_)
752 return; 754 return;
753 755
754 host_->SetNeedsAnimate(); 756 host_->SetNeedsAnimate();
755 } 757 }
756 758
757 } // namespace content 759 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698