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

Side by Side Diff: content/browser/compositor/browser_compositor_view_mac.mm

Issue 441743003: Make remote CALayers work with browser compositor on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make more methods private Created 6 years, 4 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/browser_compositor_view_mac.h" 5 #include "content/browser/compositor/browser_compositor_view_mac.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/compositor/browser_compositor_view_private_mac.h" 9 #include "content/browser/compositor/browser_compositor_view_private_mac.h"
10 #include "content/common/gpu/surface_handle_types_mac.h" 10 #include "content/common/gpu/surface_handle_types_mac.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 // static 75 // static
76 void BrowserCompositorViewMac::GotAcceleratedFrame( 76 void BrowserCompositorViewMac::GotAcceleratedFrame(
77 gfx::AcceleratedWidget widget, 77 gfx::AcceleratedWidget widget,
78 uint64 surface_handle, int surface_id, 78 uint64 surface_handle, int surface_id,
79 const std::vector<ui::LatencyInfo>& latency_info, 79 const std::vector<ui::LatencyInfo>& latency_info,
80 gfx::Size pixel_size, float scale_factor) { 80 gfx::Size pixel_size, float scale_factor) {
81 BrowserCompositorViewMacInternal* internal_view = 81 BrowserCompositorViewMacInternal* internal_view =
82 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); 82 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget);
83 if (!internal_view) 83 if (internal_view) {
84 return; 84 internal_view->GotAcceleratedFrame(
85 IOSurfaceID io_surface_id = IOSurfaceIDFromSurfaceHandle(surface_handle); 85 surface_handle, surface_id, latency_info, pixel_size, scale_factor);
86 internal_view->GotAcceleratedIOSurfaceFrame( 86 }
87 io_surface_id, surface_id, latency_info, pixel_size, scale_factor);
88 } 87 }
89 88
90 // static 89 // static
91 void BrowserCompositorViewMac::GotSoftwareFrame( 90 void BrowserCompositorViewMac::GotSoftwareFrame(
92 gfx::AcceleratedWidget widget, 91 gfx::AcceleratedWidget widget,
93 cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) { 92 cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) {
94 BrowserCompositorViewMacInternal* internal_view = 93 BrowserCompositorViewMacInternal* internal_view =
95 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); 94 BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget);
96 if (!internal_view) 95 if (internal_view)
97 return; 96 internal_view->GotSoftwareFrame(frame_data, scale_factor, canvas);
98 internal_view->GotSoftwareFrame(frame_data, scale_factor, canvas);
99 } 97 }
100 98
101 //////////////////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////////////////
102 // BrowserCompositorViewPlaceholderMac 100 // BrowserCompositorViewPlaceholderMac
103 101
104 BrowserCompositorViewPlaceholderMac::BrowserCompositorViewPlaceholderMac() { 102 BrowserCompositorViewPlaceholderMac::BrowserCompositorViewPlaceholderMac() {
105 g_placeholder_count += 1; 103 g_placeholder_count += 1;
106 } 104 }
107 105
108 BrowserCompositorViewPlaceholderMac::~BrowserCompositorViewPlaceholderMac() { 106 BrowserCompositorViewPlaceholderMac::~BrowserCompositorViewPlaceholderMac() {
109 DCHECK_GT(g_placeholder_count, 0u); 107 DCHECK_GT(g_placeholder_count, 0u);
110 g_placeholder_count -= 1; 108 g_placeholder_count -= 1;
111 109
112 // If there are no placeholders allocated, destroy the recyclable 110 // If there are no placeholders allocated, destroy the recyclable
113 // BrowserCompositorViewMacInternal. 111 // BrowserCompositorViewMacInternal.
114 if (!g_placeholder_count) 112 if (!g_placeholder_count)
115 g_recyclable_internal_view.Get().reset(); 113 g_recyclable_internal_view.Get().reset();
116 } 114 }
117 115
118 } // namespace content 116 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698