OLD | NEW |
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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 DCHECK(!needs_composite_ || WillComposite()); | 542 DCHECK(!needs_composite_ || WillComposite()); |
543 | 543 |
544 needs_composite_ = true; | 544 needs_composite_ = true; |
545 PostComposite(COMPOSITE_IMMEDIATELY); | 545 PostComposite(COMPOSITE_IMMEDIATELY); |
546 } | 546 } |
547 | 547 |
548 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 548 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
549 CreateGpuProcessViewContext( | 549 CreateGpuProcessViewContext( |
550 const scoped_refptr<GpuChannelHost>& gpu_channel_host, | 550 const scoped_refptr<GpuChannelHost>& gpu_channel_host, |
551 const blink::WebGraphicsContext3D::Attributes attributes, | 551 const blink::WebGraphicsContext3D::Attributes attributes, |
552 int surface_id) { | 552 int surface_id, |
| 553 gfx::NativeWindow nativeWindow) { |
553 GURL url("chrome://gpu/Compositor::createContext3D"); | 554 GURL url("chrome://gpu/Compositor::createContext3D"); |
554 static const size_t kBytesPerPixel = 4; | 555 static const size_t kBytesPerPixel = 4; |
555 gfx::DeviceDisplayInfo display_info; | 556 const gfx::DeviceDisplayInfo& display_info = |
| 557 nativeWindow->GetDeviceDisplayInfo(); |
556 size_t full_screen_texture_size_in_bytes = | 558 size_t full_screen_texture_size_in_bytes = |
557 display_info.GetDisplayHeight() * | 559 display_info.GetDisplayHeight() * |
558 display_info.GetDisplayWidth() * | 560 display_info.GetDisplayWidth() * |
559 kBytesPerPixel; | 561 kBytesPerPixel; |
560 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 562 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
561 limits.command_buffer_size = 64 * 1024; | 563 limits.command_buffer_size = 64 * 1024; |
562 limits.start_transfer_buffer_size = 64 * 1024; | 564 limits.start_transfer_buffer_size = 64 * 1024; |
563 limits.min_transfer_buffer_size = 64 * 1024; | 565 limits.min_transfer_buffer_size = 64 * 1024; |
564 limits.max_transfer_buffer_size = std::min( | 566 limits.max_transfer_buffer_size = std::min( |
565 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 567 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 647 |
646 BrowserGpuChannelHostFactory* factory = | 648 BrowserGpuChannelHostFactory* factory = |
647 BrowserGpuChannelHostFactory::instance(); | 649 BrowserGpuChannelHostFactory::instance(); |
648 // This channel might be lost (and even if it isn't right now, it might | 650 // This channel might be lost (and even if it isn't right now, it might |
649 // still get marked as lost from the IO thread, at any point in time really). | 651 // still get marked as lost from the IO thread, at any point in time really). |
650 // But from here on just try and always lead to either | 652 // But from here on just try and always lead to either |
651 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | 653 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). |
652 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); | 654 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); |
653 scoped_refptr<ContextProviderCommandBuffer> context_provider( | 655 scoped_refptr<ContextProviderCommandBuffer> context_provider( |
654 ContextProviderCommandBuffer::Create( | 656 ContextProviderCommandBuffer::Create( |
655 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), | 657 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_, |
| 658 root_window_), |
656 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); | 659 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); |
657 DCHECK(context_provider.get()); | 660 DCHECK(context_provider.get()); |
658 | 661 |
659 scoped_ptr<cc::OutputSurface> real_output_surface( | 662 scoped_ptr<cc::OutputSurface> real_output_surface( |
660 new OutputSurfaceWithoutParent( | 663 new OutputSurfaceWithoutParent( |
661 this, context_provider, | 664 this, context_provider, |
662 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | 665 base::Bind(&CompositorImpl::PopulateGpuCapabilities, |
663 base::Unretained(this)))); | 666 base::Unretained(this)))); |
664 | 667 |
665 cc::SurfaceManager* manager = GetSurfaceManager(); | 668 cc::SurfaceManager* manager = GetSurfaceManager(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 802 |
800 void CompositorImpl::SetNeedsAnimate() { | 803 void CompositorImpl::SetNeedsAnimate() { |
801 needs_animate_ = true; | 804 needs_animate_ = true; |
802 if (!host_->visible()) | 805 if (!host_->visible()) |
803 return; | 806 return; |
804 | 807 |
805 host_->SetNeedsAnimate(); | 808 host_->SetNeedsAnimate(); |
806 } | 809 } |
807 | 810 |
808 } // namespace content | 811 } // namespace content |
OLD | NEW |