Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: blimp/client/app/compositor/browser_compositor.cc

Issue 2542083004: Make //blimp/client/app a real embedder of //blimp/client/public (Closed)
Patch Set: Fix findbugs issue Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « blimp/client/app/blimp_startup.cc ('k') | blimp/client/app/linux/blimp_client_session_linux.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/app/compositor/browser_compositor.h" 5 #include "blimp/client/app/compositor/browser_compositor.h"
6 6
7 #include "blimp/client/public/compositor/compositor_dependencies.h" 7 #include "blimp/client/public/compositor/compositor_dependencies.h"
8 #include "blimp/client/support/compositor/blimp_context_provider.h" 8 #include "blimp/client/support/compositor/blimp_context_provider.h"
9 #include "cc/output/context_provider.h" 9 #include "cc/output/context_provider.h"
10 10
11 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) 11 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
12 #include "gpu/ipc/common/gpu_surface_tracker.h" 12 #include "gpu/ipc/common/gpu_surface_tracker.h"
13 #endif 13 #endif
14 14
15 namespace blimp { 15 namespace blimp {
16 namespace client { 16 namespace client {
17 17
18 BrowserCompositor::BrowserCompositor( 18 BrowserCompositor::BrowserCompositor(
19 CompositorDependencies* compositor_dependencies) 19 CompositorDependencies* compositor_dependencies)
20 : BlimpEmbedderCompositor(compositor_dependencies) {} 20 : BlimpEmbedderCompositor(compositor_dependencies) {}
21 21
22 BrowserCompositor::~BrowserCompositor() { 22 BrowserCompositor::~BrowserCompositor() {
23 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) 23 SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
24 if (surface_handle_ != gpu::kNullSurfaceHandle)
25 gpu::GpuSurfaceTracker::Get()->RemoveSurface(surface_handle_);
26 #endif
27 } 24 }
28 25
29 void BrowserCompositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) { 26 void BrowserCompositor::SetAcceleratedWidget(gfx::AcceleratedWidget widget) {
30 scoped_refptr<cc::ContextProvider> provider; 27 scoped_refptr<cc::ContextProvider> provider;
31 28
29 if (surface_handle_ != gpu::kNullSurfaceHandle) {
30 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
31 gpu::GpuSurfaceTracker::Get()->RemoveSurface(surface_handle_);
32 #endif
33 surface_handle_ = gpu::kNullSurfaceHandle;
34 }
35
32 if (widget != gfx::kNullAcceleratedWidget) { 36 if (widget != gfx::kNullAcceleratedWidget) {
33 DCHECK_EQ(gpu::kNullSurfaceHandle, surface_handle_);
34 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW) 37 #if !defined(GPU_SURFACE_HANDLE_IS_ACCELERATED_WINDOW)
35 surface_handle_ = 38 surface_handle_ =
36 gpu::GpuSurfaceTracker::Get()->AddSurfaceForNativeWidget(widget); 39 gpu::GpuSurfaceTracker::Get()->AddSurfaceForNativeWidget(widget);
37 #else 40 #else
38 surface_handle_ = widget; 41 surface_handle_ = widget;
39 #endif 42 #endif
40 provider = BlimpContextProvider::Create( 43 provider = BlimpContextProvider::Create(
41 surface_handle_, 44 surface_handle_,
42 compositor_dependencies()->GetGpuMemoryBufferManager()); 45 compositor_dependencies()->GetGpuMemoryBufferManager());
43 } 46 }
44 47
45 SetContextProvider(std::move(provider)); 48 SetContextProvider(std::move(provider));
46 } 49 }
47 50
48 void BrowserCompositor::DidReceiveCompositorFrameAck() { 51 void BrowserCompositor::DidReceiveCompositorFrameAck() {
49 if (!did_complete_swap_buffers_.is_null()) { 52 if (!did_complete_swap_buffers_.is_null()) {
50 did_complete_swap_buffers_.Run(); 53 did_complete_swap_buffers_.Run();
51 } 54 }
52 } 55 }
53 56
54 } // namespace client 57 } // namespace client
55 } // namespace blimp 58 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/blimp_startup.cc ('k') | blimp/client/app/linux/blimp_client_session_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698