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

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

Issue 15682010: Support plumbing LatencyInfo through the old software path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // The RangeChanged message is only sent with valid values. The current 717 // The RangeChanged message is only sent with valid values. The current
718 // caret position (start == end) will be sent if there is no IME range. 718 // caret position (start == end) will be sent if there is no IME range.
719 [cocoa_view_ setMarkedRange:range.ToNSRange()]; 719 [cocoa_view_ setMarkedRange:range.ToNSRange()];
720 composition_range_ = range; 720 composition_range_ = range;
721 composition_bounds_ = character_bounds; 721 composition_bounds_ = character_bounds;
722 } 722 }
723 723
724 void RenderWidgetHostViewMac::DidUpdateBackingStore( 724 void RenderWidgetHostViewMac::DidUpdateBackingStore(
725 const gfx::Rect& scroll_rect, 725 const gfx::Rect& scroll_rect,
726 const gfx::Vector2d& scroll_delta, 726 const gfx::Vector2d& scroll_delta,
727 const std::vector<gfx::Rect>& copy_rects) { 727 const std::vector<gfx::Rect>& copy_rects,
728 const ui::LatencyInfo& latency_info) {
728 GotSoftwareFrame(); 729 GotSoftwareFrame();
729 730
731 software_latency_info_.MergeWith(latency_info);
732
730 if (!is_hidden_) { 733 if (!is_hidden_) {
731 std::vector<gfx::Rect> rects(copy_rects); 734 std::vector<gfx::Rect> rects(copy_rects);
732 735
733 // Because the findbar might be open, we cannot use scrollRect:by: here. For 736 // Because the findbar might be open, we cannot use scrollRect:by: here. For
734 // now, simply mark all of scroll rect as dirty. 737 // now, simply mark all of scroll rect as dirty.
735 if (!scroll_rect.IsEmpty()) 738 if (!scroll_rect.IsEmpty())
736 rects.push_back(scroll_rect); 739 rects.push_back(scroll_rect);
737 740
738 for (size_t i = 0; i < rects.size(); ++i) { 741 for (size_t i = 0; i < rects.size(); ++i) {
739 NSRect ns_rect = [cocoa_view_ flipRectToNSRect:rects[i]]; 742 NSRect ns_rect = [cocoa_view_ flipRectToNSRect:rects[i]];
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 1589
1587 gfx::Rect RenderWidgetHostViewMac::GetScaledOpenGLPixelRect( 1590 gfx::Rect RenderWidgetHostViewMac::GetScaledOpenGLPixelRect(
1588 const gfx::Rect& rect) { 1591 const gfx::Rect& rect) {
1589 gfx::Rect src_gl_subrect = rect; 1592 gfx::Rect src_gl_subrect = rect;
1590 src_gl_subrect.set_y(GetViewBounds().height() - rect.bottom()); 1593 src_gl_subrect.set_y(GetViewBounds().height() - rect.bottom());
1591 1594
1592 return gfx::ToEnclosingRect(gfx::ScaleRect(src_gl_subrect, 1595 return gfx::ToEnclosingRect(gfx::ScaleRect(src_gl_subrect,
1593 ScaleFactor(cocoa_view_))); 1596 ScaleFactor(cocoa_view_)));
1594 } 1597 }
1595 1598
1599 void RenderWidgetHostViewMac::FrameSwapped() {
1600 software_latency_info_.swap_timestamp = base::TimeTicks::HighResNow();
1601 render_widget_host_->FrameSwapped(software_latency_info_);
1602 software_latency_info_.Clear();
1603 }
1604
1596 } // namespace content 1605 } // namespace content
1597 1606
1598 // RenderWidgetHostViewCocoa --------------------------------------------------- 1607 // RenderWidgetHostViewCocoa ---------------------------------------------------
1599 1608
1600 @implementation RenderWidgetHostViewCocoa 1609 @implementation RenderWidgetHostViewCocoa
1601 1610
1602 @synthesize selectedRange = selectedRange_; 1611 @synthesize selectedRange = selectedRange_;
1603 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_; 1612 @synthesize suppressNextEscapeKeyUp = suppressNextEscapeKeyUp_;
1604 @synthesize markedRange = markedRange_; 1613 @synthesize markedRange = markedRange_;
1605 @synthesize delegate = delegate_; 1614 @synthesize delegate = delegate_;
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 CGContextRef context = static_cast<CGContextRef>( 2386 CGContextRef context = static_cast<CGContextRef>(
2378 [[NSGraphicsContext currentContext] graphicsPort]); 2387 [[NSGraphicsContext currentContext] graphicsPort]);
2379 base::mac::ScopedCFTypeRef<CGImageRef> image( 2388 base::mac::ScopedCFTypeRef<CGImageRef> image(
2380 CGBitmapContextCreateImage(backingStore->cg_bitmap())); 2389 CGBitmapContextCreateImage(backingStore->cg_bitmap()));
2381 CGRect imageRect = bitmapRect.ToCGRect(); 2390 CGRect imageRect = bitmapRect.ToCGRect();
2382 imageRect.origin.y = yOffset; 2391 imageRect.origin.y = yOffset;
2383 CGContextDrawImage(context, imageRect, image); 2392 CGContextDrawImage(context, imageRect, image);
2384 } 2393 }
2385 } 2394 }
2386 2395
2396 renderWidgetHostView_->FrameSwapped();
2397
2387 // Fill the remaining portion of the damagedRect with white 2398 // Fill the remaining portion of the damagedRect with white
2388 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect]; 2399 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect];
2389 2400
2390 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) { 2401 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) {
2391 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - 2402 base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
2392 renderWidgetHostView_->whiteout_start_time_; 2403 renderWidgetHostView_->whiteout_start_time_;
2393 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); 2404 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration);
2394 2405
2395 // Reset the start time to 0 so that we start recording again the next 2406 // Reset the start time to 0 so that we start recording again the next
2396 // time the backing store is NULL... 2407 // time the backing store is NULL...
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 if (!string) return NO; 3417 if (!string) return NO;
3407 3418
3408 // If the user is currently using an IME, confirm the IME input, 3419 // If the user is currently using an IME, confirm the IME input,
3409 // and then insert the text from the service, the same as TextEdit and Safari. 3420 // and then insert the text from the service, the same as TextEdit and Safari.
3410 [self confirmComposition]; 3421 [self confirmComposition];
3411 [self insertText:string]; 3422 [self insertText:string];
3412 return YES; 3423 return YES;
3413 } 3424 }
3414 3425
3415 @end 3426 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698