Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 627 base::CompareCase::SENSITIVE)) { | 627 base::CompareCase::SENSITIVE)) { |
| 628 return WebSettings::V8CacheStrategiesForCacheStorage::Normal; | 628 return WebSettings::V8CacheStrategiesForCacheStorage::Normal; |
| 629 } else if (base::StartsWith(v8_cache_strategies, "aggressive", | 629 } else if (base::StartsWith(v8_cache_strategies, "aggressive", |
| 630 base::CompareCase::SENSITIVE)) { | 630 base::CompareCase::SENSITIVE)) { |
| 631 return WebSettings::V8CacheStrategiesForCacheStorage::Aggressive; | 631 return WebSettings::V8CacheStrategiesForCacheStorage::Aggressive; |
| 632 } else { | 632 } else { |
| 633 return WebSettings::V8CacheStrategiesForCacheStorage::Default; | 633 return WebSettings::V8CacheStrategiesForCacheStorage::Default; |
| 634 } | 634 } |
| 635 } | 635 } |
| 636 | 636 |
| 637 // This class represents promise which is robust to (will not be broken by) | |
| 638 // |DidNotSwapReason::SWAP_FAILS| events. | |
| 639 class CC_EXPORT AlwaysDrawSwapPromise : public cc::SwapPromise { | |
|
danakj
2016/08/11 21:59:00
drop the CC_EXPORT
svartmetal
2016/08/12 10:07:33
Fixed.
| |
| 640 public: | |
| 641 explicit AlwaysDrawSwapPromise(const ui::LatencyInfo& latency_info) | |
| 642 : latency_info_(latency_info) {} | |
| 643 | |
| 644 ~AlwaysDrawSwapPromise() override = default; | |
| 645 | |
| 646 void DidActivate() override {} | |
| 647 | |
| 648 void DidSwap(cc::CompositorFrameMetadata* metadata) override { | |
| 649 DCHECK(!latency_info_.terminated()); | |
| 650 metadata->latency_info.push_back(latency_info_); | |
| 651 } | |
| 652 | |
| 653 DidNotSwapAction DidNotSwap(DidNotSwapReason reason) override { | |
| 654 return reason == DidNotSwapReason::SWAP_FAILS | |
| 655 ? DidNotSwapAction::KEEP_ACTIVE | |
| 656 : DidNotSwapAction::BREAK_PROMISE; | |
| 657 } | |
| 658 | |
| 659 void OnCommit() override {} | |
| 660 | |
| 661 int64_t TraceId() const override { return latency_info_.trace_id(); } | |
| 662 | |
| 663 private: | |
| 664 ui::LatencyInfo latency_info_; | |
| 665 }; | |
| 666 | |
| 637 } // namespace | 667 } // namespace |
| 638 | 668 |
| 639 RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps, | 669 RenderViewImpl::RenderViewImpl(CompositorDependencies* compositor_deps, |
| 640 const ViewMsg_New_Params& params) | 670 const ViewMsg_New_Params& params) |
| 641 : RenderWidget(compositor_deps, | 671 : RenderWidget(compositor_deps, |
| 642 blink::WebPopupTypeNone, | 672 blink::WebPopupTypeNone, |
| 643 params.initial_size.screen_info, | 673 params.initial_size.screen_info, |
| 644 params.swapped_out, | 674 params.swapped_out, |
| 645 params.hidden, | 675 params.hidden, |
| 646 params.never_visible), | 676 params.never_visible), |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1457 frames_with_pending_state_.clear(); | 1487 frames_with_pending_state_.clear(); |
| 1458 } | 1488 } |
| 1459 | 1489 |
| 1460 void RenderViewImpl::ApplyWebPreferencesInternal( | 1490 void RenderViewImpl::ApplyWebPreferencesInternal( |
| 1461 const WebPreferences& prefs, | 1491 const WebPreferences& prefs, |
| 1462 blink::WebView* web_view, | 1492 blink::WebView* web_view, |
| 1463 CompositorDependencies* compositor_deps) { | 1493 CompositorDependencies* compositor_deps) { |
| 1464 ApplyWebPreferences(prefs, web_view); | 1494 ApplyWebPreferences(prefs, web_view); |
| 1465 } | 1495 } |
| 1466 | 1496 |
| 1467 void RenderViewImpl::OnForceRedraw(int id) { | 1497 void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) { |
| 1468 ui::LatencyInfo latency_info; | |
| 1469 if (id) { | |
| 1470 latency_info.AddLatencyNumber(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | |
| 1471 0, | |
| 1472 id); | |
| 1473 } | |
| 1474 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor; | |
| 1475 if (RenderWidgetCompositor* rwc = compositor()) { | 1498 if (RenderWidgetCompositor* rwc = compositor()) { |
| 1476 latency_info_swap_promise_monitor = | 1499 rwc->QueueSwapPromise( |
| 1477 rwc->CreateLatencyInfoSwapPromiseMonitor(&latency_info); | 1500 base::WrapUnique(new AlwaysDrawSwapPromise(latency_info))); |
|
danakj
2016/08/11 21:59:00
one last nit: prefer base::MakeUnique<AlwaysDrawSw
svartmetal
2016/08/12 10:07:33
Fixed.
| |
| 1478 } | 1501 } |
| 1479 ScheduleCompositeWithForcedRedraw(); | 1502 ScheduleCompositeWithForcedRedraw(); |
| 1480 } | 1503 } |
| 1481 | 1504 |
| 1482 // blink::WebViewClient ------------------------------------------------------ | 1505 // blink::WebViewClient ------------------------------------------------------ |
| 1483 | 1506 |
| 1484 WebView* RenderViewImpl::createView(WebLocalFrame* creator, | 1507 WebView* RenderViewImpl::createView(WebLocalFrame* creator, |
| 1485 const WebURLRequest& request, | 1508 const WebURLRequest& request, |
| 1486 const WebWindowFeatures& features, | 1509 const WebWindowFeatures& features, |
| 1487 const WebString& frame_name, | 1510 const WebString& frame_name, |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3081 return render_frame->focused_pepper_plugin(); | 3104 return render_frame->focused_pepper_plugin(); |
| 3082 } | 3105 } |
| 3083 frame = frame->traverseNext(false); | 3106 frame = frame->traverseNext(false); |
| 3084 } | 3107 } |
| 3085 | 3108 |
| 3086 return nullptr; | 3109 return nullptr; |
| 3087 } | 3110 } |
| 3088 #endif | 3111 #endif |
| 3089 | 3112 |
| 3090 } // namespace content | 3113 } // namespace content |
| OLD | NEW |