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

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

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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 #include <QuartzCore/QuartzCore.h> 7 #include <QuartzCore/QuartzCore.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1044
1045 bool RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle, 1045 bool RenderWidgetHostViewMac::CompositorSwapBuffers(uint64 surface_handle,
1046 const gfx::Size& size) { 1046 const gfx::Size& size) {
1047 if (is_hidden_) 1047 if (is_hidden_)
1048 return true; 1048 return true;
1049 1049
1050 NSWindow* window = [cocoa_view_ window]; 1050 NSWindow* window = [cocoa_view_ window];
1051 if (window_number() <= 0) { 1051 if (window_number() <= 0) {
1052 // There is no window to present so capturing during present won't work. 1052 // There is no window to present so capturing during present won't work.
1053 // We check if frame subscriber wants this frame and capture manually. 1053 // We check if frame subscriber wants this frame and capture manually.
1054 if (compositing_iosurface_.get() && frame_subscriber_.get()) { 1054 if (compositing_iosurface_.get() && frame_subscriber_) {
1055 scoped_refptr<media::VideoFrame> frame; 1055 scoped_refptr<media::VideoFrame> frame;
1056 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; 1056 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback;
1057 if (frame_subscriber_->ShouldCaptureFrame(&frame, &callback)) { 1057 if (frame_subscriber_->ShouldCaptureFrame(&frame, &callback)) {
1058 compositing_iosurface_->SetIOSurface(surface_handle, size); 1058 compositing_iosurface_->SetIOSurface(surface_handle, size);
1059 compositing_iosurface_->CopyToVideoFrame( 1059 compositing_iosurface_->CopyToVideoFrame(
1060 gfx::Rect(size), ScaleFactor(cocoa_view_), frame, 1060 gfx::Rect(size), ScaleFactor(cocoa_view_), frame,
1061 base::Bind(callback, base::Time::Now())); 1061 base::Bind(callback, base::Time::Now()));
1062 return true; 1062 return true;
1063 } 1063 }
1064 } 1064 }
(...skipping 12 matching lines...) Expand all
1077 base::StringPrintf("window %s delegate %s controller %s", 1077 base::StringPrintf("window %s delegate %s controller %s",
1078 object_getClassName(window), 1078 object_getClassName(window),
1079 object_getClassName([window delegate]), 1079 object_getClassName([window delegate]),
1080 object_getClassName([window windowController])); 1080 object_getClassName([window windowController]));
1081 base::debug::SetCrashKeyValue(kCrashKey, value); 1081 base::debug::SetCrashKeyValue(kCrashKey, value);
1082 } 1082 }
1083 1083
1084 return true; 1084 return true;
1085 } 1085 }
1086 1086
1087 if (!compositing_iosurface_.get()) { 1087 if (!compositing_iosurface_) {
1088 CompositingIOSurfaceMac::SurfaceOrder order = allow_overlapping_views_ ? 1088 CompositingIOSurfaceMac::SurfaceOrder order = allow_overlapping_views_ ?
1089 CompositingIOSurfaceMac::SURFACE_ORDER_BELOW_WINDOW : 1089 CompositingIOSurfaceMac::SURFACE_ORDER_BELOW_WINDOW :
1090 CompositingIOSurfaceMac::SURFACE_ORDER_ABOVE_WINDOW; 1090 CompositingIOSurfaceMac::SURFACE_ORDER_ABOVE_WINDOW;
1091 compositing_iosurface_.reset( 1091 compositing_iosurface_.reset(
1092 CompositingIOSurfaceMac::Create(window_number(), order)); 1092 CompositingIOSurfaceMac::Create(window_number(), order));
1093 } 1093 }
1094 1094
1095 if (!compositing_iosurface_.get()) 1095 if (!compositing_iosurface_)
1096 return true; 1096 return true;
1097 1097
1098 compositing_iosurface_->SetIOSurface(surface_handle, size); 1098 compositing_iosurface_->SetIOSurface(surface_handle, size);
1099 1099
1100 GotAcceleratedFrame(); 1100 GotAcceleratedFrame();
1101 1101
1102 gfx::Size window_size(NSSizeToCGSize([cocoa_view_ frame].size)); 1102 gfx::Size window_size(NSSizeToCGSize([cocoa_view_ frame].size));
1103 if (window_size.IsEmpty()) { 1103 if (window_size.IsEmpty()) {
1104 // setNeedsDisplay will never display and we'll never ack if the window is 1104 // setNeedsDisplay will never display and we'll never ack if the window is
1105 // empty, so ack now and don't bother calling setNeedsDisplay below. 1105 // empty, so ack now and don't bother calling setNeedsDisplay below.
(...skipping 10 matching lines...) Expand all
1116 } 1116 }
1117 return true; 1117 return true;
1118 } 1118 }
1119 1119
1120 void RenderWidgetHostViewMac::AckPendingSwapBuffers() { 1120 void RenderWidgetHostViewMac::AckPendingSwapBuffers() {
1121 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers"); 1121 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::AckPendingSwapBuffers");
1122 while (!pending_swap_buffers_acks_.empty()) { 1122 while (!pending_swap_buffers_acks_.empty()) {
1123 if (pending_swap_buffers_acks_.front().first != 0) { 1123 if (pending_swap_buffers_acks_.front().first != 0) {
1124 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; 1124 AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
1125 ack_params.sync_point = 0; 1125 ack_params.sync_point = 0;
1126 if (compositing_iosurface_.get()) 1126 if (compositing_iosurface_)
1127 ack_params.renderer_id = compositing_iosurface_->GetRendererID(); 1127 ack_params.renderer_id = compositing_iosurface_->GetRendererID();
1128 RenderWidgetHostImpl::AcknowledgeBufferPresent( 1128 RenderWidgetHostImpl::AcknowledgeBufferPresent(
1129 pending_swap_buffers_acks_.front().first, 1129 pending_swap_buffers_acks_.front().first,
1130 pending_swap_buffers_acks_.front().second, 1130 pending_swap_buffers_acks_.front().second,
1131 ack_params); 1131 ack_params);
1132 if (render_widget_host_) { 1132 if (render_widget_host_) {
1133 render_widget_host_->AcknowledgeSwapBuffersToRenderer(); 1133 render_widget_host_->AcknowledgeSwapBuffersToRenderer();
1134 1134
1135 // Send VSync parameters to compositor thread. 1135 // Send VSync parameters to compositor thread.
1136 if (compositing_iosurface_.get()) { 1136 if (compositing_iosurface_) {
1137 base::TimeTicks timebase; 1137 base::TimeTicks timebase;
1138 uint32 numerator = 0, denominator = 0; 1138 uint32 numerator = 0, denominator = 0;
1139 compositing_iosurface_->GetVSyncParameters(&timebase, 1139 compositing_iosurface_->GetVSyncParameters(&timebase,
1140 &numerator, 1140 &numerator,
1141 &denominator); 1141 &denominator);
1142 if (numerator > 0 && denominator > 0) { 1142 if (numerator > 0 && denominator > 0) {
1143 int64 interval_micros = 1143 int64 interval_micros =
1144 1000000 * static_cast<int64>(numerator) / denominator; 1144 1000000 * static_cast<int64>(numerator) / denominator;
1145 render_widget_host_->UpdateVSyncParameters( 1145 render_widget_host_->UpdateVSyncParameters(
1146 timebase, base::TimeDelta::FromMicroseconds(interval_micros)); 1146 timebase, base::TimeDelta::FromMicroseconds(interval_micros));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1300 1300
1301 pending_swap_buffers_acks_.push_back(std::make_pair(params.route_id, 1301 pending_swap_buffers_acks_.push_back(std::make_pair(params.route_id,
1302 gpu_host_id)); 1302 gpu_host_id));
1303 1303
1304 if (CompositorSwapBuffers(params.surface_handle, params.surface_size)) 1304 if (CompositorSwapBuffers(params.surface_handle, params.surface_size))
1305 AckPendingSwapBuffers(); 1305 AckPendingSwapBuffers();
1306 } 1306 }
1307 1307
1308 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() { 1308 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() {
1309 if (compositing_iosurface_.get()) 1309 if (compositing_iosurface_)
1310 compositing_iosurface_->UnrefIOSurface(); 1310 compositing_iosurface_->UnrefIOSurface();
1311 } 1311 }
1312 1312
1313 void RenderWidgetHostViewMac::AcceleratedSurfaceRelease() { 1313 void RenderWidgetHostViewMac::AcceleratedSurfaceRelease() {
1314 compositing_iosurface_.reset(); 1314 compositing_iosurface_.reset();
1315 } 1315 }
1316 1316
1317 bool RenderWidgetHostViewMac::HasAcceleratedSurface( 1317 bool RenderWidgetHostViewMac::HasAcceleratedSurface(
1318 const gfx::Size& desired_size) { 1318 const gfx::Size& desired_size) {
1319 return last_frame_was_accelerated_ && 1319 return last_frame_was_accelerated_ &&
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 withObject:nil 2176 withObject:nil
2177 afterDelay:0]; 2177 afterDelay:0];
2178 } 2178 }
2179 } 2179 }
2180 2180
2181 - (void)globalFrameDidChange:(NSNotification*)notification { 2181 - (void)globalFrameDidChange:(NSNotification*)notification {
2182 if (handlingGlobalFrameDidChange_) 2182 if (handlingGlobalFrameDidChange_)
2183 return; 2183 return;
2184 2184
2185 handlingGlobalFrameDidChange_ = YES; 2185 handlingGlobalFrameDidChange_ = YES;
2186 if (renderWidgetHostView_->compositing_iosurface_.get()) 2186 if (renderWidgetHostView_->compositing_iosurface_)
2187 renderWidgetHostView_->compositing_iosurface_->GlobalFrameDidChange(); 2187 renderWidgetHostView_->compositing_iosurface_->GlobalFrameDidChange();
2188 handlingGlobalFrameDidChange_ = NO; 2188 handlingGlobalFrameDidChange_ = NO;
2189 } 2189 }
2190 2190
2191 - (void)windowChangedGlobalFrame:(NSNotification*)notification { 2191 - (void)windowChangedGlobalFrame:(NSNotification*)notification {
2192 renderWidgetHostView_->UpdateScreenInfo( 2192 renderWidgetHostView_->UpdateScreenInfo(
2193 renderWidgetHostView_->GetNativeView()); 2193 renderWidgetHostView_->GetNativeView());
2194 } 2194 }
2195 2195
2196 - (void)setFrameSize:(NSSize)newSize { 2196 - (void)setFrameSize:(NSSize)newSize {
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3360 if (!string) return NO; 3360 if (!string) return NO;
3361 3361
3362 // If the user is currently using an IME, confirm the IME input, 3362 // If the user is currently using an IME, confirm the IME input,
3363 // and then insert the text from the service, the same as TextEdit and Safari. 3363 // and then insert the text from the service, the same as TextEdit and Safari.
3364 [self confirmComposition]; 3364 [self confirmComposition];
3365 [self insertText:string]; 3365 [self insertText:string];
3366 return YES; 3366 return YES;
3367 } 3367 }
3368 3368
3369 @end 3369 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698