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 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "cc/output/output_surface.h" | 37 #include "cc/output/output_surface.h" |
| 38 #include "cc/output/output_surface_client.h" | 38 #include "cc/output/output_surface_client.h" |
| 39 #include "cc/output/texture_mailbox_deleter.h" | 39 #include "cc/output/texture_mailbox_deleter.h" |
| 40 #include "cc/output/vulkan_in_process_context_provider.h" | 40 #include "cc/output/vulkan_in_process_context_provider.h" |
| 41 #include "cc/raster/single_thread_task_graph_runner.h" | 41 #include "cc/raster/single_thread_task_graph_runner.h" |
| 42 #include "cc/scheduler/begin_frame_source.h" | 42 #include "cc/scheduler/begin_frame_source.h" |
| 43 #include "cc/surfaces/display.h" | 43 #include "cc/surfaces/display.h" |
| 44 #include "cc/surfaces/display_scheduler.h" | 44 #include "cc/surfaces/display_scheduler.h" |
| 45 #include "cc/surfaces/surface_display_output_surface.h" | 45 #include "cc/surfaces/surface_display_output_surface.h" |
| 46 #include "cc/surfaces/surface_id_allocator.h" | 46 #include "cc/surfaces/surface_id_allocator.h" |
| 47 #include "cc/surfaces/surface_manager.h" | |
| 48 #include "cc/trees/layer_tree_host.h" | 47 #include "cc/trees/layer_tree_host.h" |
| 49 #include "cc/trees/layer_tree_settings.h" | 48 #include "cc/trees/layer_tree_settings.h" |
| 50 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" | 49 #include "components/display_compositor/compositor_overlay_candidate_validator_a ndroid.h" |
| 51 #include "components/display_compositor/gl_helper.h" | 50 #include "components/display_compositor/gl_helper.h" |
| 52 #include "content/browser/android/child_process_launcher_android.h" | 51 #include "content/browser/android/child_process_launcher_android.h" |
| 53 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | |
| 54 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 52 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 55 #include "content/browser/gpu/compositor_util.h" | 53 #include "content/browser/gpu/compositor_util.h" |
| 56 #include "content/browser/gpu/gpu_surface_tracker.h" | 54 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 55 #include "content/browser/renderer_host/context_provider_factory_impl_android.h" | |
| 57 #include "content/browser/renderer_host/render_widget_host_impl.h" | 56 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 58 #include "content/common/gpu/client/context_provider_command_buffer.h" | 57 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 59 #include "content/common/gpu_process_launch_causes.h" | 58 #include "content/common/gpu_process_launch_causes.h" |
| 60 #include "content/common/host_shared_bitmap_manager.h" | 59 #include "content/common/host_shared_bitmap_manager.h" |
| 61 #include "content/public/browser/android/compositor.h" | 60 #include "content/public/browser/android/compositor.h" |
| 62 #include "content/public/browser/android/compositor_client.h" | 61 #include "content/public/browser/android/compositor_client.h" |
| 63 #include "content/public/common/content_switches.h" | 62 #include "content/public/common/content_switches.h" |
| 64 #include "gpu/command_buffer/client/context_support.h" | 63 #include "gpu/command_buffer/client/context_support.h" |
| 65 #include "gpu/command_buffer/client/gles2_interface.h" | 64 #include "gpu/command_buffer/client/gles2_interface.h" |
| 66 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | 65 #include "gpu/ipc/client/command_buffer_proxy_impl.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 OutputSurface::OnSwapBuffersComplete(); | 280 OutputSurface::OnSwapBuffersComplete(); |
| 282 } | 281 } |
| 283 | 282 |
| 284 private: | 283 private: |
| 285 std::unique_ptr<gpu::VulkanSurface> surface_; | 284 std::unique_ptr<gpu::VulkanSurface> surface_; |
| 286 | 285 |
| 287 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface); | 286 DISALLOW_COPY_AND_ASSIGN(VulkanOutputSurface); |
| 288 }; | 287 }; |
| 289 #endif | 288 #endif |
| 290 | 289 |
| 291 base::LazyInstance<scoped_refptr<cc::VulkanInProcessContextProvider>> | |
| 292 g_shared_vulkan_context_provider_android_ = LAZY_INSTANCE_INITIALIZER; | |
| 293 | |
| 294 static bool g_initialized = false; | 290 static bool g_initialized = false; |
| 295 | 291 |
| 296 base::LazyInstance<cc::SurfaceManager> g_surface_manager = | |
| 297 LAZY_INSTANCE_INITIALIZER; | |
| 298 | |
| 299 int g_surface_client_id = 0; | |
| 300 | |
| 301 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { | 292 class SingleThreadTaskGraphRunner : public cc::SingleThreadTaskGraphRunner { |
| 302 public: | 293 public: |
| 303 SingleThreadTaskGraphRunner() { | 294 SingleThreadTaskGraphRunner() { |
| 304 Start("CompositorTileWorker1", base::SimpleThread::Options()); | 295 Start("CompositorTileWorker1", base::SimpleThread::Options()); |
| 305 } | 296 } |
| 306 | 297 |
| 307 ~SingleThreadTaskGraphRunner() override { | 298 ~SingleThreadTaskGraphRunner() override { |
| 308 Shutdown(); | 299 Shutdown(); |
| 309 } | 300 } |
| 310 }; | 301 }; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 324 void Compositor::Initialize() { | 315 void Compositor::Initialize() { |
| 325 DCHECK(!CompositorImpl::IsInitialized()); | 316 DCHECK(!CompositorImpl::IsInitialized()); |
| 326 g_initialized = true; | 317 g_initialized = true; |
| 327 } | 318 } |
| 328 | 319 |
| 329 // static | 320 // static |
| 330 bool CompositorImpl::IsInitialized() { | 321 bool CompositorImpl::IsInitialized() { |
| 331 return g_initialized; | 322 return g_initialized; |
| 332 } | 323 } |
| 333 | 324 |
| 334 // static | |
| 335 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { | |
| 336 return g_surface_manager.Pointer(); | |
| 337 } | |
| 338 | |
| 339 // static | |
| 340 uint32_t CompositorImpl::AllocateSurfaceClientId() { | |
| 341 return ++g_surface_client_id; | |
| 342 } | |
| 343 | |
| 344 // static | |
| 345 scoped_refptr<cc::VulkanInProcessContextProvider> | |
| 346 CompositorImpl::SharedVulkanContextProviderAndroid() { | |
| 347 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 348 switches::kEnableVulkan)) { | |
| 349 scoped_refptr<cc::VulkanInProcessContextProvider>* context_provider = | |
| 350 g_shared_vulkan_context_provider_android_.Pointer(); | |
| 351 if (!*context_provider) | |
| 352 *context_provider = cc::VulkanInProcessContextProvider::Create(); | |
| 353 return *context_provider; | |
| 354 } | |
| 355 return nullptr; | |
| 356 } | |
| 357 | |
| 358 CompositorImpl::CompositorImpl(CompositorClient* client, | 325 CompositorImpl::CompositorImpl(CompositorClient* client, |
| 359 gfx::NativeWindow root_window) | 326 gfx::NativeWindow root_window) |
| 360 : surface_id_allocator_( | 327 : surface_id_allocator_( |
| 361 new cc::SurfaceIdAllocator(AllocateSurfaceClientId())), | 328 new cc::SurfaceIdAllocator(ui::ContextProviderFactory::GetInstance() |
| 329 ->AllocateSurfaceClientId())), | |
| 362 resource_manager_(root_window), | 330 resource_manager_(root_window), |
| 363 has_transparent_background_(false), | 331 has_transparent_background_(false), |
| 364 device_scale_factor_(1), | 332 device_scale_factor_(1), |
| 365 window_(NULL), | 333 window_(NULL), |
| 366 surface_handle_(gpu::kNullSurfaceHandle), | 334 surface_handle_(gpu::kNullSurfaceHandle), |
| 367 client_(client), | 335 client_(client), |
| 368 root_window_(root_window), | 336 root_window_(root_window), |
| 369 needs_animate_(false), | 337 needs_animate_(false), |
| 370 pending_swapbuffers_(0U), | 338 pending_swapbuffers_(0U), |
| 371 num_successive_context_creation_failures_(0), | 339 num_successive_context_creation_failures_(0), |
| 372 output_surface_request_pending_(false), | 340 output_surface_request_pending_(false), |
| 373 needs_begin_frames_(false), | 341 needs_begin_frames_(false), |
| 374 weak_factory_(this) { | 342 weak_factory_(this) { |
| 375 GetSurfaceManager()->RegisterSurfaceClientId( | 343 ui::ContextProviderFactory::GetInstance() |
| 376 surface_id_allocator_->client_id()); | 344 ->GetSurfaceManager() |
| 345 ->RegisterSurfaceClientId(surface_id_allocator_->client_id()); | |
| 377 DCHECK(client); | 346 DCHECK(client); |
| 378 DCHECK(root_window); | 347 DCHECK(root_window); |
| 379 DCHECK(root_window->GetLayer() == nullptr); | 348 DCHECK(root_window->GetLayer() == nullptr); |
| 380 root_window->SetLayer(cc::Layer::Create()); | 349 root_window->SetLayer(cc::Layer::Create()); |
| 381 root_window->AttachCompositor(this); | 350 root_window->AttachCompositor(this); |
| 382 CreateLayerTreeHost(); | 351 CreateLayerTreeHost(); |
| 383 resource_manager_.Init(host_.get()); | 352 resource_manager_.Init(host_.get()); |
| 384 } | 353 } |
| 385 | 354 |
| 386 CompositorImpl::~CompositorImpl() { | 355 CompositorImpl::~CompositorImpl() { |
| 387 root_window_->DetachCompositor(); | 356 root_window_->DetachCompositor(); |
| 388 root_window_->SetLayer(nullptr); | 357 root_window_->SetLayer(nullptr); |
| 389 // Clean-up any surface references. | 358 // Clean-up any surface references. |
| 390 SetSurface(NULL); | 359 SetSurface(NULL); |
| 391 GetSurfaceManager()->InvalidateSurfaceClientId( | 360 ui::ContextProviderFactory::GetInstance() |
| 392 surface_id_allocator_->client_id()); | 361 ->GetSurfaceManager() |
| 362 ->InvalidateSurfaceClientId(surface_id_allocator_->client_id()); | |
| 393 } | 363 } |
| 394 | 364 |
| 395 ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 365 ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
| 396 return *this; | 366 return *this; |
| 397 } | 367 } |
| 398 | 368 |
| 399 ui::ResourceManager& CompositorImpl::GetResourceManager() { | 369 ui::ResourceManager& CompositorImpl::GetResourceManager() { |
| 400 return resource_manager_; | 370 return resource_manager_; |
| 401 } | 371 } |
| 402 | 372 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 } | 454 } |
| 485 | 455 |
| 486 void CompositorImpl::SetVisible(bool visible) { | 456 void CompositorImpl::SetVisible(bool visible) { |
| 487 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); | 457 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); |
| 488 if (!visible) { | 458 if (!visible) { |
| 489 DCHECK(host_->visible()); | 459 DCHECK(host_->visible()); |
| 490 host_->SetVisible(false); | 460 host_->SetVisible(false); |
| 491 if (!host_->output_surface_lost()) | 461 if (!host_->output_surface_lost()) |
| 492 host_->ReleaseOutputSurface(); | 462 host_->ReleaseOutputSurface(); |
| 493 pending_swapbuffers_ = 0; | 463 pending_swapbuffers_ = 0; |
| 494 establish_gpu_channel_timeout_.Stop(); | |
|
no sievers
2016/07/29 19:14:30
Hmm I wonder why this was here, and how we could c
Khushal
2016/07/29 21:30:55
This happens when the surface goes away. Is that r
no sievers
2016/07/29 21:42:41
I don't remember why this is here. It seems to som
| |
| 495 display_.reset(); | 464 display_.reset(); |
| 496 } else { | 465 } else { |
| 497 host_->SetVisible(true); | 466 host_->SetVisible(true); |
| 498 if (output_surface_request_pending_) | 467 if (output_surface_request_pending_) |
| 499 RequestNewOutputSurface(); | 468 RequestNewOutputSurface(); |
| 500 } | 469 } |
| 501 } | 470 } |
| 502 | 471 |
| 503 void CompositorImpl::setDeviceScaleFactor(float factor) { | 472 void CompositorImpl::setDeviceScaleFactor(float factor) { |
| 504 device_scale_factor_ = factor; | 473 device_scale_factor_ = factor; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 532 } | 501 } |
| 533 | 502 |
| 534 void CompositorImpl::UpdateLayerTreeHost() { | 503 void CompositorImpl::UpdateLayerTreeHost() { |
| 535 client_->UpdateLayerTreeHost(); | 504 client_->UpdateLayerTreeHost(); |
| 536 if (needs_animate_) { | 505 if (needs_animate_) { |
| 537 needs_animate_ = false; | 506 needs_animate_ = false; |
| 538 root_window_->Animate(base::TimeTicks::Now()); | 507 root_window_->Animate(base::TimeTicks::Now()); |
| 539 } | 508 } |
| 540 } | 509 } |
| 541 | 510 |
| 542 void CompositorImpl::OnGpuChannelEstablished() { | 511 void CompositorImpl::OnGpuChannelEstablished( |
| 543 establish_gpu_channel_timeout_.Stop(); | 512 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { |
| 544 CreateOutputSurface(); | 513 CreateOutputSurface(std::move(gpu_channel_host)); |
| 545 } | |
| 546 | |
| 547 void CompositorImpl::OnGpuChannelTimeout() { | |
| 548 LOG(FATAL) << "Timed out waiting for GPU channel."; | |
| 549 } | 514 } |
| 550 | 515 |
| 551 void CompositorImpl::RequestNewOutputSurface() { | 516 void CompositorImpl::RequestNewOutputSurface() { |
| 552 output_surface_request_pending_ = true; | 517 output_surface_request_pending_ = true; |
| 553 | 518 CreateOutputSurface(nullptr); |
| 554 #if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || \ | |
| 555 defined(SYZYASAN) || defined(CYGPROFILE_INSTRUMENTATION) | |
| 556 const int64_t kGpuChannelTimeoutInSeconds = 40; | |
| 557 #else | |
| 558 const int64_t kGpuChannelTimeoutInSeconds = 10; | |
| 559 #endif | |
| 560 | |
| 561 BrowserGpuChannelHostFactory* factory = | |
| 562 BrowserGpuChannelHostFactory::instance(); | |
| 563 if (!factory->GetGpuChannel()) { | |
| 564 factory->EstablishGpuChannel( | |
| 565 CAUSE_FOR_GPU_LAUNCH_DISPLAY_COMPOSITOR_CONTEXT, | |
| 566 base::Bind(&CompositorImpl::OnGpuChannelEstablished, | |
| 567 weak_factory_.GetWeakPtr())); | |
| 568 establish_gpu_channel_timeout_.Start( | |
| 569 FROM_HERE, base::TimeDelta::FromSeconds(kGpuChannelTimeoutInSeconds), | |
| 570 this, &CompositorImpl::OnGpuChannelTimeout); | |
| 571 return; | |
| 572 } | |
| 573 | |
| 574 CreateOutputSurface(); | |
| 575 } | 519 } |
| 576 | 520 |
| 577 void CompositorImpl::DidInitializeOutputSurface() { | 521 void CompositorImpl::DidInitializeOutputSurface() { |
| 578 num_successive_context_creation_failures_ = 0; | 522 num_successive_context_creation_failures_ = 0; |
| 579 output_surface_request_pending_ = false; | 523 output_surface_request_pending_ = false; |
| 580 } | 524 } |
| 581 | 525 |
| 582 void CompositorImpl::DidFailToInitializeOutputSurface() { | 526 void CompositorImpl::DidFailToInitializeOutputSurface() { |
| 583 LOG(ERROR) << "Failed to init OutputSurface for compositor."; | 527 LOG(ERROR) << "Failed to init OutputSurface for compositor."; |
| 584 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) | 528 LOG_IF(FATAL, ++num_successive_context_creation_failures_ >= 2) |
| 585 << "Too many context creation failures. Giving up... "; | 529 << "Too many context creation failures. Giving up... "; |
| 586 RequestNewOutputSurface(); | 530 RequestNewOutputSurface(); |
| 587 } | 531 } |
| 588 | 532 |
| 589 void CompositorImpl::CreateOutputSurface() { | 533 void CompositorImpl::CreateOutputSurface( |
| 534 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) { | |
| 590 // We might have had a request from a LayerTreeHost that was then | 535 // We might have had a request from a LayerTreeHost that was then |
| 591 // hidden (and hidden means we don't have a native surface). | 536 // hidden (and hidden means we don't have a native surface). |
| 592 // Also make sure we only handle this once. | 537 // Also make sure we only handle this once. |
| 593 if (!output_surface_request_pending_ || !host_->visible()) | 538 if (!output_surface_request_pending_ || !host_->visible()) |
| 594 return; | 539 return; |
| 595 | 540 |
| 596 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 541 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| 597 scoped_refptr<cc::VulkanInProcessContextProvider> vulkan_context_provider = | 542 scoped_refptr<cc::VulkanInProcessContextProvider> vulkan_context_provider = |
| 598 SharedVulkanContextProviderAndroid(); | 543 ContextProviderFactoryImpl::GetInstance() |
| 544 ->GetSharedVulkanContextProviderAndroid(); | |
| 599 std::unique_ptr<cc::OutputSurface> display_output_surface; | 545 std::unique_ptr<cc::OutputSurface> display_output_surface; |
| 600 #if defined(ENABLE_VULKAN) | 546 #if defined(ENABLE_VULKAN) |
| 601 std::unique_ptr<VulkanOutputSurface> vulkan_surface; | 547 std::unique_ptr<VulkanOutputSurface> vulkan_surface; |
| 602 if (vulkan_context_provider) { | 548 if (vulkan_context_provider) { |
| 603 vulkan_surface.reset( | 549 vulkan_surface.reset( |
| 604 new VulkanOutputSurface(std::move(vulkan_context_provider))); | 550 new VulkanOutputSurface(std::move(vulkan_context_provider))); |
| 605 if (!vulkan_surface->Initialize(window_)) { | 551 if (!vulkan_surface->Initialize(window_)) { |
| 606 vulkan_surface->Destroy(); | 552 vulkan_surface->Destroy(); |
| 607 vulkan_surface.reset(); | 553 vulkan_surface.reset(); |
| 608 } else { | 554 } else { |
| 609 display_output_surface = std::move(vulkan_surface); | 555 display_output_surface = std::move(vulkan_surface); |
| 610 } | 556 } |
| 611 } | 557 } |
| 612 #endif | 558 #endif |
| 613 | 559 |
| 560 if (!gpu_channel_host) { | |
| 561 ContextProviderFactoryImpl::GetInstance()->RequestGpuChannel(base::Bind( | |
| 562 &CompositorImpl::OnGpuChannelEstablished, weak_factory_.GetWeakPtr())); | |
| 563 return; | |
| 564 } | |
| 565 | |
| 614 if (!display_output_surface) { | 566 if (!display_output_surface) { |
| 615 // This is used for the browser compositor (offscreen) and for the display | 567 // This is used for the browser compositor (offscreen) and for the display |
| 616 // compositor (onscreen), so ask for capabilities needed by either one. | 568 // compositor (onscreen), so ask for capabilities needed by either one. |
| 617 // The default framebuffer for an offscreen context is not used, so it does | 569 // The default framebuffer for an offscreen context is not used, so it does |
| 618 // not need alpha, stencil, depth, antialiasing. The display compositor does | 570 // not need alpha, stencil, depth, antialiasing. The display compositor does |
| 619 // not use these things either, except for alpha when it has a transparent | 571 // not use these things either, except for alpha when it has a transparent |
| 620 // background. | 572 // background. |
| 621 gpu::gles2::ContextCreationAttribHelper attributes; | 573 gpu::gles2::ContextCreationAttribHelper attributes; |
| 622 attributes.alpha_size = -1; | 574 attributes.alpha_size = -1; |
| 623 attributes.stencil_size = 0; | 575 attributes.stencil_size = 0; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 640 attributes.red_size = 5; | 592 attributes.red_size = 5; |
| 641 attributes.green_size = 6; | 593 attributes.green_size = 6; |
| 642 attributes.blue_size = 5; | 594 attributes.blue_size = 5; |
| 643 } | 595 } |
| 644 | 596 |
| 645 pending_swapbuffers_ = 0; | 597 pending_swapbuffers_ = 0; |
| 646 | 598 |
| 647 DCHECK(window_); | 599 DCHECK(window_); |
| 648 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); | 600 DCHECK_NE(surface_handle_, gpu::kNullSurfaceHandle); |
| 649 | 601 |
| 650 BrowserGpuChannelHostFactory* factory = | |
| 651 BrowserGpuChannelHostFactory::instance(); | |
| 652 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | |
| 653 factory->GetGpuChannel()); | |
| 654 // If the channel was already lost, we'll get null back here and need to | |
| 655 // try again. | |
| 656 if (!gpu_channel_host) { | |
| 657 RequestNewOutputSurface(); | |
| 658 return; | |
| 659 } | |
| 660 | |
| 661 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); | 602 GURL url("chrome://gpu/CompositorImpl::CreateOutputSurface"); |
| 662 constexpr bool automatic_flushes = false; | 603 constexpr bool automatic_flushes = false; |
| 663 constexpr bool support_locking = false; | 604 constexpr bool support_locking = false; |
| 664 | 605 |
| 665 constexpr size_t kBytesPerPixel = 4; | 606 constexpr size_t kBytesPerPixel = 4; |
| 666 const size_t full_screen_texture_size_in_bytes = | 607 const size_t full_screen_texture_size_in_bytes = |
| 667 gfx::DeviceDisplayInfo().GetDisplayHeight() * | 608 gfx::DeviceDisplayInfo().GetDisplayHeight() * |
| 668 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; | 609 gfx::DeviceDisplayInfo().GetDisplayWidth() * kBytesPerPixel; |
| 669 | 610 |
| 670 gpu::SharedMemoryLimits limits; | 611 gpu::SharedMemoryLimits limits; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 686 gpu::GpuStreamPriority::NORMAL, surface_handle_, url, automatic_flushes, | 627 gpu::GpuStreamPriority::NORMAL, surface_handle_, url, automatic_flushes, |
| 687 support_locking, limits, attributes, nullptr, | 628 support_locking, limits, attributes, nullptr, |
| 688 command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); | 629 command_buffer_metrics::DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT); |
| 689 DCHECK(context_provider.get()); | 630 DCHECK(context_provider.get()); |
| 690 | 631 |
| 691 display_output_surface = base::WrapUnique(new OutputSurfaceWithoutParent( | 632 display_output_surface = base::WrapUnique(new OutputSurfaceWithoutParent( |
| 692 context_provider, base::Bind(&CompositorImpl::PopulateGpuCapabilities, | 633 context_provider, base::Bind(&CompositorImpl::PopulateGpuCapabilities, |
| 693 base::Unretained(this)))); | 634 base::Unretained(this)))); |
| 694 } | 635 } |
| 695 | 636 |
| 696 cc::SurfaceManager* manager = GetSurfaceManager(); | 637 cc::SurfaceManager* manager = |
| 638 ui::ContextProviderFactory::GetInstance()->GetSurfaceManager(); | |
| 697 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); | 639 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); |
| 698 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source( | 640 std::unique_ptr<ExternalBeginFrameSource> begin_frame_source( |
| 699 new ExternalBeginFrameSource(this)); | 641 new ExternalBeginFrameSource(this)); |
| 700 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( | 642 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
| 701 begin_frame_source.get(), task_runner, | 643 begin_frame_source.get(), task_runner, |
| 702 display_output_surface->capabilities().max_frames_pending)); | 644 display_output_surface->capabilities().max_frames_pending)); |
| 703 | 645 |
| 704 display_.reset(new cc::Display( | 646 display_.reset(new cc::Display( |
| 705 HostSharedBitmapManager::current(), | 647 HostSharedBitmapManager::current(), |
| 706 BrowserGpuMemoryBufferManager::current(), | 648 BrowserGpuMemoryBufferManager::current(), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 void CompositorImpl::SetNeedsAnimate() { | 743 void CompositorImpl::SetNeedsAnimate() { |
| 802 needs_animate_ = true; | 744 needs_animate_ = true; |
| 803 if (!host_->visible()) | 745 if (!host_->visible()) |
| 804 return; | 746 return; |
| 805 | 747 |
| 806 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 748 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 807 host_->SetNeedsAnimate(); | 749 host_->SetNeedsAnimate(); |
| 808 } | 750 } |
| 809 | 751 |
| 810 } // namespace content | 752 } // namespace content |
| OLD | NEW |