| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 358 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
| 359 return ui_resource_provider_; | 359 return ui_resource_provider_; |
| 360 } | 360 } |
| 361 | 361 |
| 362 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { | 362 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { |
| 363 return ui_resource_provider_.GetSystemUIResourceManager(); | 363 return ui_resource_provider_.GetSystemUIResourceManager(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { | 366 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
| 367 if (subroot_layer_) { | 367 if (subroot_layer_.get()) { |
| 368 subroot_layer_->RemoveFromParent(); | 368 subroot_layer_->RemoveFromParent(); |
| 369 subroot_layer_ = NULL; | 369 subroot_layer_ = NULL; |
| 370 } | 370 } |
| 371 if (root_layer) { | 371 if (root_layer.get()) { |
| 372 subroot_layer_ = root_layer; | 372 subroot_layer_ = root_layer; |
| 373 root_layer_->AddChild(root_layer); | 373 root_layer_->AddChild(root_layer); |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 | 376 |
| 377 void CompositorImpl::SetWindowSurface(ANativeWindow* window) { | 377 void CompositorImpl::SetWindowSurface(ANativeWindow* window) { |
| 378 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); | 378 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); |
| 379 | 379 |
| 380 if (window_) { | 380 if (window_) { |
| 381 tracker->RemoveSurface(surface_id_); | 381 tracker->RemoveSurface(surface_id_); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 508 |
| 509 needs_composite_ = true; | 509 needs_composite_ = true; |
| 510 PostComposite(COMPOSITE_IMMEDIATELY); | 510 PostComposite(COMPOSITE_IMMEDIATELY); |
| 511 } | 511 } |
| 512 | 512 |
| 513 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 513 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 514 CreateGpuProcessViewContext( | 514 CreateGpuProcessViewContext( |
| 515 const scoped_refptr<GpuChannelHost>& gpu_channel_host, | 515 const scoped_refptr<GpuChannelHost>& gpu_channel_host, |
| 516 const blink::WebGraphicsContext3D::Attributes attributes, | 516 const blink::WebGraphicsContext3D::Attributes attributes, |
| 517 int surface_id) { | 517 int surface_id) { |
| 518 DCHECK(gpu_channel_host); | 518 DCHECK(gpu_channel_host.get()); |
| 519 | 519 |
| 520 GURL url("chrome://gpu/Compositor::createContext3D"); | 520 GURL url("chrome://gpu/Compositor::createContext3D"); |
| 521 static const size_t kBytesPerPixel = 4; | 521 static const size_t kBytesPerPixel = 4; |
| 522 gfx::DeviceDisplayInfo display_info; | 522 gfx::DeviceDisplayInfo display_info; |
| 523 size_t full_screen_texture_size_in_bytes = | 523 size_t full_screen_texture_size_in_bytes = |
| 524 display_info.GetDisplayHeight() * | 524 display_info.GetDisplayHeight() * |
| 525 display_info.GetDisplayWidth() * | 525 display_info.GetDisplayWidth() * |
| 526 kBytesPerPixel; | 526 kBytesPerPixel; |
| 527 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 527 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| 528 limits.command_buffer_size = 64 * 1024; | 528 limits.command_buffer_size = 64 * 1024; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 attrs.noAutomaticFlushes = true; | 571 attrs.noAutomaticFlushes = true; |
| 572 pending_swapbuffers_ = 0; | 572 pending_swapbuffers_ = 0; |
| 573 | 573 |
| 574 DCHECK(window_); | 574 DCHECK(window_); |
| 575 DCHECK(surface_id_); | 575 DCHECK(surface_id_); |
| 576 | 576 |
| 577 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 577 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| 578 BrowserGpuChannelHostFactory* factory = | 578 BrowserGpuChannelHostFactory* factory = |
| 579 BrowserGpuChannelHostFactory::instance(); | 579 BrowserGpuChannelHostFactory::instance(); |
| 580 scoped_refptr<GpuChannelHost> gpu_channel_host = factory->GetGpuChannel(); | 580 scoped_refptr<GpuChannelHost> gpu_channel_host = factory->GetGpuChannel(); |
| 581 if (gpu_channel_host && !gpu_channel_host->IsLost()) { | 581 if (gpu_channel_host.get() && !gpu_channel_host->IsLost()) { |
| 582 context_provider = ContextProviderCommandBuffer::Create( | 582 context_provider = ContextProviderCommandBuffer::Create( |
| 583 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), | 583 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), |
| 584 "BrowserCompositor"); | 584 "BrowserCompositor"); |
| 585 } | 585 } |
| 586 if (!context_provider.get()) { | 586 if (!context_provider.get()) { |
| 587 LOG(ERROR) << "Failed to create 3D context for compositor."; | 587 LOG(ERROR) << "Failed to create 3D context for compositor."; |
| 588 host_->SetOutputSurface(scoped_ptr<cc::OutputSurface>()); | 588 host_->SetOutputSurface(scoped_ptr<cc::OutputSurface>()); |
| 589 return; | 589 return; |
| 590 } | 590 } |
| 591 | 591 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 687 } |
| 688 | 688 |
| 689 void CompositorImpl::SetNeedsAnimate() { | 689 void CompositorImpl::SetNeedsAnimate() { |
| 690 if (!host_) | 690 if (!host_) |
| 691 return; | 691 return; |
| 692 | 692 |
| 693 host_->SetNeedsAnimate(); | 693 host_->SetNeedsAnimate(); |
| 694 } | 694 } |
| 695 | 695 |
| 696 } // namespace content | 696 } // namespace content |
| OLD | NEW |