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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 2185823005: Make RenderViewImpl::OnForceRedraw more robust (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation again Created 4 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 base::CompareCase::SENSITIVE)) { 624 base::CompareCase::SENSITIVE)) {
625 return WebSettings::V8CacheStrategiesForCacheStorage::Normal; 625 return WebSettings::V8CacheStrategiesForCacheStorage::Normal;
626 } else if (base::StartsWith(v8_cache_strategies, "aggressive", 626 } else if (base::StartsWith(v8_cache_strategies, "aggressive",
627 base::CompareCase::SENSITIVE)) { 627 base::CompareCase::SENSITIVE)) {
628 return WebSettings::V8CacheStrategiesForCacheStorage::Aggressive; 628 return WebSettings::V8CacheStrategiesForCacheStorage::Aggressive;
629 } else { 629 } else {
630 return WebSettings::V8CacheStrategiesForCacheStorage::Default; 630 return WebSettings::V8CacheStrategiesForCacheStorage::Default;
631 } 631 }
632 } 632 }
633 633
634 // This class represents promise which is robust to (will not be broken by)
635 // |DidNotSwapReason::SWAP_FAILS| events.
636 class AlwaysDrawSwapPromise : public cc::SwapPromise {
637 public:
638 explicit AlwaysDrawSwapPromise(const ui::LatencyInfo& latency_info)
639 : latency_info_(latency_info) {}
640
641 ~AlwaysDrawSwapPromise() override = default;
642
643 void DidActivate() override {}
644
645 void DidSwap(cc::CompositorFrameMetadata* metadata) override {
646 DCHECK(!latency_info_.terminated());
647 metadata->latency_info.push_back(latency_info_);
648 }
649
650 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override {
651 return reason == DidNotSwapReason::SWAP_FAILS
652 ? DidNotSwapAction::KEEP_ACTIVE
653 : DidNotSwapAction::BREAK_PROMISE;
654 }
655
656 void OnCommit() override {}
657
658 int64_t TraceId() const override { return latency_info_.trace_id(); }
659
660 private:
661 ui::LatencyInfo latency_info_;
662 };
663
634 } // namespace 664 } // namespace
635 665
636 RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps, 666 RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps,
637 const ViewMsg_New_Params& params) 667 const ViewMsg_New_Params& params)
638 : RenderWidget(compositor_deps, 668 : RenderWidget(compositor_deps,
639 blink::WebPopupTypeNone, 669 blink::WebPopupTypeNone,
640 params.initial_size.screen_info, 670 params.initial_size.screen_info,
641 params.swapped_out, 671 params.swapped_out,
642 params.hidden, 672 params.hidden,
643 params.never_visible), 673 params.never_visible),
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 frames_with_pending_state_.clear(); 1489 frames_with_pending_state_.clear();
1460 } 1490 }
1461 1491
1462 void RenderViewImpl::ApplyWebPreferencesInternal( 1492 void RenderViewImpl::ApplyWebPreferencesInternal(
1463 const WebPreferences& prefs, 1493 const WebPreferences& prefs,
1464 blink::WebView* web_view, 1494 blink::WebView* web_view,
1465 CompositorDependencies* compositor_deps) { 1495 CompositorDependencies* compositor_deps) {
1466 ApplyWebPreferences(prefs, web_view); 1496 ApplyWebPreferences(prefs, web_view);
1467 } 1497 }
1468 1498
1469 void RenderViewImpl::OnForceRedraw(int id) { 1499 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) {
1470 ui::LatencyInfo latency_info;
1471 if (id) {
1472 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT,
1473 0,
1474 id);
1475 }
1476 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor;
1477 if (RenderWidgetCompositor* rwc = compositor()) { 1500 if (RenderWidgetCompositor* rwc = compositor()) {
1478 latency_info_swap_promise_monitor = 1501 rwc->QueueSwapPromise(
1479 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info); 1502 base::MakeUnique<AlwaysDrawSwapPromise>(latency_info));
1480 } 1503 }
1481 ScheduleCompositeWithForcedRedraw(); 1504 ScheduleCompositeWithForcedRedraw();
1482 } 1505 }
1483 1506
1484 // blink::WebViewClient ------------------------------------------------------ 1507 // blink::WebViewClient ------------------------------------------------------
1485 1508
1486 WebView* RenderViewImpl::createView(WebLocalFrame* creator, 1509 WebView* RenderViewImpl::createView(WebLocalFrame* creator,
1487 const WebURLRequest& request, 1510 const WebURLRequest& request,
1488 const WebWindowFeatures& features, 1511 const WebWindowFeatures& features,
1489 const WebString& frame_name, 1512 const WebString& frame_name,
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
3079 return render_frame->focused_pepper_plugin(); 3102 return render_frame->focused_pepper_plugin();
3080 } 3103 }
3081 frame = frame->traverseNext(false); 3104 frame = frame->traverseNext(false);
3082 } 3105 }
3083 3106
3084 return nullptr; 3107 return nullptr;
3085 } 3108 }
3086 #endif 3109 #endif
3087 3110
3088 } // namespace content 3111 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698