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

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: Move screen_android.cc from ui/gfx/ to ui/android/. 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 DCHECK(!needs_composite_ || WillComposite()); 535 DCHECK(!needs_composite_ || WillComposite());
536 536
537 needs_composite_ = true; 537 needs_composite_ = true;
538 PostComposite(COMPOSITE_IMMEDIATELY); 538 PostComposite(COMPOSITE_IMMEDIATELY);
539 } 539 }
540 540
541 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 541 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
542 CreateGpuProcessViewContext( 542 CreateGpuProcessViewContext(
543 const scoped_refptr<GpuChannelHost>& gpu_channel_host, 543 const scoped_refptr<GpuChannelHost>& gpu_channel_host,
544 const blink::WebGraphicsContext3D::Attributes attributes, 544 const blink::WebGraphicsContext3D::Attributes attributes,
545 int surface_id) { 545 int surface_id,
546 gfx::NativeWindow nativeWindow) {
546 GURL url("chrome://gpu/Compositor::createContext3D"); 547 GURL url("chrome://gpu/Compositor::createContext3D");
547 static const size_t kBytesPerPixel = 4; 548 static const size_t kBytesPerPixel = 4;
548 gfx::DeviceDisplayInfo display_info; 549 std::shared_ptr<gfx::DeviceDisplayInfo>
550 display_info(nativeWindow->GetDeviceDisplayInfo());
549 size_t full_screen_texture_size_in_bytes = 551 size_t full_screen_texture_size_in_bytes =
550 display_info.GetDisplayHeight() * 552 display_info->GetDisplayHeight() *
551 display_info.GetDisplayWidth() * 553 display_info->GetDisplayWidth() *
552 kBytesPerPixel; 554 kBytesPerPixel;
553 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 555 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
554 limits.command_buffer_size = 64 * 1024; 556 limits.command_buffer_size = 64 * 1024;
555 limits.start_transfer_buffer_size = 64 * 1024; 557 limits.start_transfer_buffer_size = 64 * 1024;
556 limits.min_transfer_buffer_size = 64 * 1024; 558 limits.min_transfer_buffer_size = 64 * 1024;
557 limits.max_transfer_buffer_size = std::min( 559 limits.max_transfer_buffer_size = std::min(
558 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); 560 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
559 limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024; 561 limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024;
560 bool lose_context_when_out_of_memory = true; 562 bool lose_context_when_out_of_memory = true;
561 return make_scoped_ptr( 563 return make_scoped_ptr(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 638
637 BrowserGpuChannelHostFactory* factory = 639 BrowserGpuChannelHostFactory* factory =
638 BrowserGpuChannelHostFactory::instance(); 640 BrowserGpuChannelHostFactory::instance();
639 // This channel might be lost (and even if it isn't right now, it might 641 // This channel might be lost (and even if it isn't right now, it might
640 // still get marked as lost from the IO thread, at any point in time really). 642 // still get marked as lost from the IO thread, at any point in time really).
641 // But from here on just try and always lead to either 643 // But from here on just try and always lead to either
642 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). 644 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface().
643 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); 645 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel());
644 scoped_refptr<ContextProviderCommandBuffer> context_provider( 646 scoped_refptr<ContextProviderCommandBuffer> context_provider(
645 ContextProviderCommandBuffer::Create( 647 ContextProviderCommandBuffer::Create(
646 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), 648 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_,
649 root_window_),
647 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); 650 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT));
648 DCHECK(context_provider.get()); 651 DCHECK(context_provider.get());
649 652
650 scoped_ptr<cc::OutputSurface> real_output_surface( 653 scoped_ptr<cc::OutputSurface> real_output_surface(
651 new OutputSurfaceWithoutParent(context_provider, 654 new OutputSurfaceWithoutParent(context_provider,
652 weak_factory_.GetWeakPtr())); 655 weak_factory_.GetWeakPtr()));
653 656
654 cc::SurfaceManager* manager = GetSurfaceManager(); 657 cc::SurfaceManager* manager = GetSurfaceManager();
655 if (manager) { 658 if (manager) {
656 display_client_.reset(new cc::OnscreenDisplayClient( 659 display_client_.reset(new cc::OnscreenDisplayClient(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 764
762 void CompositorImpl::SetNeedsAnimate() { 765 void CompositorImpl::SetNeedsAnimate() {
763 needs_animate_ = true; 766 needs_animate_ = true;
764 if (!host_) 767 if (!host_)
765 return; 768 return;
766 769
767 host_->SetNeedsAnimate(); 770 host_->SetNeedsAnimate();
768 } 771 }
769 772
770 } // namespace content 773 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698