Chromium Code Reviews| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface( | 532 scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface( |
| 533 bool fallback) { | 533 bool fallback) { |
| 534 blink::WebGraphicsContext3D::Attributes attrs; | 534 blink::WebGraphicsContext3D::Attributes attrs; |
| 535 attrs.shareResources = true; | 535 attrs.shareResources = true; |
| 536 attrs.noAutomaticFlushes = true; | 536 attrs.noAutomaticFlushes = true; |
| 537 pending_swapbuffers_ = 0; | 537 pending_swapbuffers_ = 0; |
| 538 | 538 |
| 539 DCHECK(window_); | 539 DCHECK(window_); |
| 540 DCHECK(surface_id_); | 540 DCHECK(surface_id_); |
| 541 | 541 |
| 542 scoped_refptr<ContextProviderCommandBuffer> context_provider; | |
| 543 BrowserGpuChannelHostFactory* factory = | 542 BrowserGpuChannelHostFactory* factory = |
| 544 BrowserGpuChannelHostFactory::instance(); | 543 BrowserGpuChannelHostFactory::instance(); |
| 545 scoped_refptr<GpuChannelHost> gpu_channel_host = factory->GetGpuChannel(); | 544 scoped_refptr<GpuChannelHost> gpu_channel_host = factory->GetGpuChannel(); |
| 546 if (gpu_channel_host && !gpu_channel_host->IsLost()) { | 545 if (gpu_channel_host && !gpu_channel_host->IsLost()) { |
| 547 context_provider = ContextProviderCommandBuffer::Create( | 546 context_provider_ = ContextProviderCommandBuffer::Create( |
|
no sievers
2014/08/21 23:02:50
Is there a way we can pass this through without ha
aelias_OOO_until_Jul13
2014/08/23 01:28:50
Done, I took the OutputSurfaceWithoutParent approa
| |
| 548 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), | 547 CreateGpuProcessViewContext(gpu_channel_host, attrs, surface_id_), |
| 549 "BrowserCompositor"); | 548 "BrowserCompositor"); |
| 550 } | 549 } |
| 551 if (!context_provider.get()) { | 550 if (!context_provider_.get()) { |
| 552 LOG(ERROR) << "Failed to create 3D context for compositor."; | 551 LOG(ERROR) << "Failed to create 3D context for compositor."; |
| 553 return scoped_ptr<cc::OutputSurface>(); | 552 return scoped_ptr<cc::OutputSurface>(); |
| 554 } | 553 } |
| 555 | 554 |
| 556 return scoped_ptr<cc::OutputSurface>( | 555 return scoped_ptr<cc::OutputSurface>( |
| 557 new OutputSurfaceWithoutParent(context_provider)); | 556 new OutputSurfaceWithoutParent(context_provider_)); |
| 557 } | |
| 558 | |
| 559 void CompositorImpl::DidInitializeOutputSurface() { | |
| 560 ui_resource_provider_.SetSupportsETC1NonPowerOfTwo( | |
| 561 context_provider_->ContextCapabilities().gpu.texture_format_etc1_npot); | |
| 558 } | 562 } |
| 559 | 563 |
| 560 void CompositorImpl::OnLostResources() { | 564 void CompositorImpl::OnLostResources() { |
| 561 client_->DidLoseResources(); | 565 client_->DidLoseResources(); |
| 562 ui_resource_provider_.UIResourcesAreInvalid(); | 566 ui_resource_provider_.UIResourcesAreInvalid(); |
| 563 } | 567 } |
| 564 | 568 |
| 565 void CompositorImpl::ScheduleComposite() { | 569 void CompositorImpl::ScheduleComposite() { |
| 566 DCHECK(!needs_composite_ || WillComposite()); | 570 DCHECK(!needs_composite_ || WillComposite()); |
| 567 if (ignore_schedule_composite_) | 571 if (ignore_schedule_composite_) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 } | 649 } |
| 646 | 650 |
| 647 void CompositorImpl::SetNeedsAnimate() { | 651 void CompositorImpl::SetNeedsAnimate() { |
| 648 if (!host_) | 652 if (!host_) |
| 649 return; | 653 return; |
| 650 | 654 |
| 651 host_->SetNeedsAnimate(); | 655 host_->SetNeedsAnimate(); |
| 652 } | 656 } |
| 653 | 657 |
| 654 } // namespace content | 658 } // namespace content |
| OLD | NEW |