| 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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 void CompositorImpl::SetNeedsComposite() { | 423 void CompositorImpl::SetNeedsComposite() { |
| 424 if (!host_->visible()) | 424 if (!host_->visible()) |
| 425 return; | 425 return; |
| 426 host_->SetNeedsAnimate(); | 426 host_->SetNeedsAnimate(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 429 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 430 CreateGpuProcessViewContext( | 430 CreateGpuProcessViewContext( |
| 431 const scoped_refptr<GpuChannelHost>& gpu_channel_host, | 431 const scoped_refptr<GpuChannelHost>& gpu_channel_host, |
| 432 const blink::WebGraphicsContext3D::Attributes attributes, | 432 const blink::WebGraphicsContext3D::Attributes attributes, |
| 433 int surface_id) { | 433 int surface_id, |
| 434 gfx::NativeWindow native_window) { |
| 434 GURL url("chrome://gpu/Compositor::createContext3D"); | 435 GURL url("chrome://gpu/Compositor::createContext3D"); |
| 435 static const size_t kBytesPerPixel = 4; | 436 static const size_t kBytesPerPixel = 4; |
| 436 gfx::DeviceDisplayInfo display_info; | 437 const gfx::DeviceDisplayInfo& display_info = |
| 438 native_window->GetDeviceDisplayInfo(); |
| 437 size_t full_screen_texture_size_in_bytes = | 439 size_t full_screen_texture_size_in_bytes = |
| 438 display_info.GetDisplayHeight() * | 440 display_info.GetDisplayHeight() * |
| 439 display_info.GetDisplayWidth() * | 441 display_info.GetDisplayWidth() * |
| 440 kBytesPerPixel; | 442 kBytesPerPixel; |
| 441 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 443 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| 442 limits.command_buffer_size = 64 * 1024; | 444 limits.command_buffer_size = 64 * 1024; |
| 443 limits.start_transfer_buffer_size = 64 * 1024; | 445 limits.start_transfer_buffer_size = 64 * 1024; |
| 444 limits.min_transfer_buffer_size = 64 * 1024; | 446 limits.min_transfer_buffer_size = 64 * 1024; |
| 445 limits.max_transfer_buffer_size = std::min( | 447 limits.max_transfer_buffer_size = std::min( |
| 446 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); | 448 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 533 |
| 532 BrowserGpuChannelHostFactory* factory = | 534 BrowserGpuChannelHostFactory* factory = |
| 533 BrowserGpuChannelHostFactory::instance(); | 535 BrowserGpuChannelHostFactory::instance(); |
| 534 // This channel might be lost (and even if it isn't right now, it might | 536 // This channel might be lost (and even if it isn't right now, it might |
| 535 // still get marked as lost from the IO thread, at any point in time really). | 537 // still get marked as lost from the IO thread, at any point in time really). |
| 536 // But from here on just try and always lead to either | 538 // But from here on just try and always lead to either |
| 537 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). | 539 // DidInitializeOutputSurface() or DidFailToInitializeOutputSurface(). |
| 538 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); | 540 scoped_refptr<GpuChannelHost> gpu_channel_host(factory->GetGpuChannel()); |
| 539 scoped_refptr<ContextProviderCommandBuffer> context_provider( | 541 scoped_refptr<ContextProviderCommandBuffer> context_provider( |
| 540 ContextProviderCommandBuffer::Create( | 542 ContextProviderCommandBuffer::Create( |
| 541 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), | 543 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_, |
| 544 root_window_), |
| 542 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); | 545 BROWSER_COMPOSITOR_ONSCREEN_CONTEXT)); |
| 543 DCHECK(context_provider.get()); | 546 DCHECK(context_provider.get()); |
| 544 | 547 |
| 545 scoped_ptr<cc::OutputSurface> real_output_surface( | 548 scoped_ptr<cc::OutputSurface> real_output_surface( |
| 546 new OutputSurfaceWithoutParent( | 549 new OutputSurfaceWithoutParent( |
| 547 this, context_provider, | 550 this, context_provider, |
| 548 base::Bind(&CompositorImpl::PopulateGpuCapabilities, | 551 base::Bind(&CompositorImpl::PopulateGpuCapabilities, |
| 549 base::Unretained(this)))); | 552 base::Unretained(this)))); |
| 550 | 553 |
| 551 cc::SurfaceManager* manager = GetSurfaceManager(); | 554 cc::SurfaceManager* manager = GetSurfaceManager(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 | 648 |
| 646 void CompositorImpl::SetNeedsAnimate() { | 649 void CompositorImpl::SetNeedsAnimate() { |
| 647 needs_animate_ = true; | 650 needs_animate_ = true; |
| 648 if (!host_->visible()) | 651 if (!host_->visible()) |
| 649 return; | 652 return; |
| 650 | 653 |
| 651 host_->SetNeedsAnimate(); | 654 host_->SetNeedsAnimate(); |
| 652 } | 655 } |
| 653 | 656 |
| 654 } // namespace content | 657 } // namespace content |
| OLD | NEW |