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

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

Issue 274163004: Remove browser-side tracking of accelerated compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 | Annotate | Revision Log
OLDNEW
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/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <QuartzCore/QuartzCore.h> 8 #include <QuartzCore/QuartzCore.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 src_pixel_rect.width(), src_pixel_rect.height()); 1288 src_pixel_rect.width(), src_pixel_rect.height());
1289 target_canvas.drawBitmapRectToRect( 1289 target_canvas.drawBitmapRectToRect(
1290 source_bitmap, 1290 source_bitmap,
1291 &src_pixel_skrect, 1291 &src_pixel_skrect,
1292 SkRect::MakeXYWH(0, 0, dst_pixel_size.width(), dst_pixel_size.height()), 1292 SkRect::MakeXYWH(0, 0, dst_pixel_size.width(), dst_pixel_size.height()),
1293 NULL, 1293 NULL,
1294 SkCanvas::kNone_DrawBitmapRectFlag); 1294 SkCanvas::kNone_DrawBitmapRectFlag);
1295 1295
1296 ignore_result(scoped_callback_runner.Release()); 1296 ignore_result(scoped_callback_runner.Release());
1297 callback.Run(true, target_bitmap); 1297 callback.Run(true, target_bitmap);
1298 } else {
1299 callback.Run(false, SkBitmap());
1298 } 1300 }
1299 } 1301 }
1300 1302
1301 void RenderWidgetHostViewMac::CopyFromCompositingSurfaceToVideoFrame( 1303 void RenderWidgetHostViewMac::CopyFromCompositingSurfaceToVideoFrame(
1302 const gfx::Rect& src_subrect, 1304 const gfx::Rect& src_subrect,
1303 const scoped_refptr<media::VideoFrame>& target, 1305 const scoped_refptr<media::VideoFrame>& target,
1304 const base::Callback<void(bool)>& callback) { 1306 const base::Callback<void(bool)>& callback) {
1305 if (delegated_frame_host_) { 1307 if (delegated_frame_host_) {
1306 delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame( 1308 delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame(
1307 src_subrect, target, callback); 1309 src_subrect, target, callback);
1308 return; 1310 return;
1309 } 1311 }
1310 1312
1311 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); 1313 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false));
1312 if (!render_widget_host_->is_accelerated_compositing_active() || 1314 if (!compositing_iosurface_ || !compositing_iosurface_->HasIOSurface())
1313 !compositing_iosurface_ ||
1314 !compositing_iosurface_->HasIOSurface())
1315 return; 1315 return;
1316 1316
1317 if (!target.get()) { 1317 if (!target.get()) {
1318 NOTREACHED(); 1318 NOTREACHED();
1319 return; 1319 return;
1320 } 1320 }
1321 1321
1322 if (target->format() != media::VideoFrame::YV12 && 1322 if (target->format() != media::VideoFrame::YV12 &&
1323 target->format() != media::VideoFrame::I420) { 1323 target->format() != media::VideoFrame::I420) {
1324 NOTREACHED(); 1324 NOTREACHED();
1325 return; 1325 return;
1326 } 1326 }
1327 1327
1328 if (src_subrect.IsEmpty()) 1328 if (src_subrect.IsEmpty())
1329 return; 1329 return;
1330 1330
1331 ignore_result(scoped_callback_runner.Release()); 1331 ignore_result(scoped_callback_runner.Release());
1332 compositing_iosurface_->CopyToVideoFrame( 1332 compositing_iosurface_->CopyToVideoFrame(
1333 GetScaledOpenGLPixelRect(src_subrect), 1333 GetScaledOpenGLPixelRect(src_subrect),
1334 target, 1334 target,
1335 callback); 1335 callback);
1336 } 1336 }
1337 1337
1338 bool RenderWidgetHostViewMac::CanCopyToVideoFrame() const { 1338 bool RenderWidgetHostViewMac::CanCopyToVideoFrame() const {
1339 if (delegated_frame_host_) 1339 if (delegated_frame_host_)
1340 return delegated_frame_host_->CanCopyToVideoFrame(); 1340 return delegated_frame_host_->CanCopyToVideoFrame();
1341 1341
1342 return (!software_frame_manager_->HasCurrentFrame() && 1342 return (!software_frame_manager_->HasCurrentFrame() &&
1343 render_widget_host_->is_accelerated_compositing_active() &&
1344 compositing_iosurface_ && 1343 compositing_iosurface_ &&
1345 compositing_iosurface_->HasIOSurface()); 1344 compositing_iosurface_->HasIOSurface());
1346 } 1345 }
1347 1346
1348 bool RenderWidgetHostViewMac::CanSubscribeFrame() const { 1347 bool RenderWidgetHostViewMac::CanSubscribeFrame() const {
1349 if (delegated_frame_host_) 1348 if (delegated_frame_host_)
1350 return delegated_frame_host_->CanSubscribeFrame(); 1349 return delegated_frame_host_->CanSubscribeFrame();
1351 1350
1352 return !software_frame_manager_->HasCurrentFrame(); 1351 return !software_frame_manager_->HasCurrentFrame();
1353 } 1352 }
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 Source<RenderWidgetHost>(render_widget_host_), 1952 Source<RenderWidgetHost>(render_widget_host_),
1954 NotificationService::NoDetails()); 1953 NotificationService::NoDetails());
1955 } else { 1954 } else {
1956 DLOG(ERROR) << "Received unexpected frame type."; 1955 DLOG(ERROR) << "Received unexpected frame type.";
1957 RecordAction( 1956 RecordAction(
1958 base::UserMetricsAction("BadMessageTerminate_UnexpectedFrameType")); 1957 base::UserMetricsAction("BadMessageTerminate_UnexpectedFrameType"));
1959 render_widget_host_->GetProcess()->ReceivedBadMessage(); 1958 render_widget_host_->GetProcess()->ReceivedBadMessage();
1960 } 1959 }
1961 } 1960 }
1962 1961
1963 void RenderWidgetHostViewMac::OnAcceleratedCompositingStateChange() {
1964 }
1965
1966 void RenderWidgetHostViewMac::AcceleratedSurfaceInitialized(int host_id, 1962 void RenderWidgetHostViewMac::AcceleratedSurfaceInitialized(int host_id,
1967 int route_id) { 1963 int route_id) {
1968 } 1964 }
1969 1965
1970 void RenderWidgetHostViewMac::GetScreenInfo(blink::WebScreenInfo* results) { 1966 void RenderWidgetHostViewMac::GetScreenInfo(blink::WebScreenInfo* results) {
1971 *results = GetWebScreenInfo(GetNativeView()); 1967 *results = GetWebScreenInfo(GetNativeView());
1972 } 1968 }
1973 1969
1974 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { 1970 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() {
1975 // TODO(shess): In case of !window, the view has been removed from 1971 // TODO(shess): In case of !window, the view has been removed from
(...skipping 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 } 4429 }
4434 4430
4435 - (void)disableRendering { 4431 - (void)disableRendering {
4436 // Disable the fade-out animation as the layer is removed. 4432 // Disable the fade-out animation as the layer is removed.
4437 ScopedCAActionDisabler disabler; 4433 ScopedCAActionDisabler disabler;
4438 [self removeFromSuperlayer]; 4434 [self removeFromSuperlayer];
4439 renderWidgetHostView_ = nil; 4435 renderWidgetHostView_ = nil;
4440 } 4436 }
4441 4437
4442 @end // implementation SoftwareLayer 4438 @end // implementation SoftwareLayer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698