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

Side by Side Diff: content/browser/renderer_host/render_widget_helper_mac.mm

Issue 294023012: Use a separate NSView to draw browser composited content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments, clean-u Created 6 years, 7 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/renderer_host/render_widget_helper.h" 5 #include "content/browser/renderer_host/render_widget_helper.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "content/browser/compositor/browser_compositor_view_mac.h"
10 #include "content/browser/gpu/gpu_process_host.h" 11 #include "content/browser/gpu/gpu_process_host.h"
11 #include "content/browser/gpu/gpu_surface_tracker.h" 12 #include "content/browser/gpu/gpu_surface_tracker.h"
12 #include "content/common/gpu/gpu_messages.h" 13 #include "content/common/gpu/gpu_messages.h"
13 14
14 // Declare methods used to present swaps to this view.
15 @interface NSView (ContentCompositingView)
16 - (void)onNativeSurfaceBuffersSwappedWithParams:
17 (GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)params;
18 @end
19
20 @implementation NSView (ContentCompositingView)
21 - (void)onNativeSurfaceBuffersSwappedWithParams:
22 (GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params)params {
23 }
24 @end
25
26 namespace { 15 namespace {
27 16
28 void OnNativeSurfaceBuffersSwappedOnUIThread( 17 void OnNativeSurfaceBuffersSwappedOnUIThread(
29 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 18 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
30 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 19 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
31 gfx::AcceleratedWidget native_widget = 20 gfx::AcceleratedWidget native_widget =
32 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id); 21 content::GpuSurfaceTracker::Get()->AcquireNativeWidget(params.surface_id);
33 [native_widget onNativeSurfaceBuffersSwappedWithParams:params]; 22 [native_widget gotAcceleratedIOSurfaceFrame:params.surface_handle
23 withPixelSize:params.size
24 withScaleFactor:params.scale_factor];
34 } 25 }
35 26
36 } // namespace 27 } // namespace
37 28
38 namespace content { 29 namespace content {
39 30
40 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread( 31 void RenderWidgetHelper::OnNativeSurfaceBuffersSwappedOnIOThread(
41 GpuProcessHost* gpu_process_host, 32 GpuProcessHost* gpu_process_host,
42 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 33 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 34 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 14 matching lines...) Expand all
58 gpu_process_host->Send(new AcceleratedSurfaceMsg_BufferPresented( 49 gpu_process_host->Send(new AcceleratedSurfaceMsg_BufferPresented(
59 params.route_id, ack_params)); 50 params.route_id, ack_params));
60 51
61 BrowserThread::PostTask( 52 BrowserThread::PostTask(
62 BrowserThread::UI, 53 BrowserThread::UI,
63 FROM_HERE, 54 FROM_HERE,
64 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, params)); 55 base::Bind(&OnNativeSurfaceBuffersSwappedOnUIThread, params));
65 } 56 }
66 57
67 } // namespace content 58 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698