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

Side by Side Diff: components/scheduler/renderer/web_view_scheduler_impl.h

Issue 2184123002: Change VirtualTimePolicy::PAUSE_IF_NETWORK_FETCHES_PENDING (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And another test 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ 5 #ifndef COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_
6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ 6 #define COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/scheduler/base/task_queue.h" 13 #include "components/scheduler/base/task_queue.h"
14 #include "components/scheduler/scheduler_export.h" 14 #include "components/scheduler/scheduler_export.h"
15 #include "third_party/WebKit/public/platform/WebViewScheduler.h" 15 #include "third_party/WebKit/public/platform/WebViewScheduler.h"
16 16
17 namespace base { 17 namespace base {
18 namespace trace_event { 18 namespace trace_event {
19 class BlameContext; 19 class BlameContext;
20 } // namespace trace_event 20 } // namespace trace_event
21 class SingleThreadTaskRunner; 21 class SingleThreadTaskRunner;
22 } // namespace base 22 } // namespace base
23 23
24 namespace blink { 24 namespace blink {
25 class WebView; 25 class WebView;
26 } // namespace blink 26 } // namespace blink
27 27
28 namespace scheduler { 28 namespace scheduler {
29 29
30 class AutoAdvancingVirtualTimeDomain;
31 class RendererSchedulerImpl; 30 class RendererSchedulerImpl;
32 class WebFrameSchedulerImpl; 31 class WebFrameSchedulerImpl;
33 32
34 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler { 33 class SCHEDULER_EXPORT WebViewSchedulerImpl : public blink::WebViewScheduler {
35 public: 34 public:
36 WebViewSchedulerImpl(blink::WebView* web_view, 35 WebViewSchedulerImpl(blink::WebView* web_view,
37 RendererSchedulerImpl* renderer_scheduler, 36 RendererSchedulerImpl* renderer_scheduler,
38 bool disable_background_timer_throttling); 37 bool disable_background_timer_throttling);
39 38
40 ~WebViewSchedulerImpl() override; 39 ~WebViewSchedulerImpl() override;
41 40
42 // blink::WebViewScheduler implementation: 41 // blink::WebViewScheduler implementation:
43 void setPageVisible(bool page_visible) override; 42 void setPageVisible(bool page_visible) override;
44 std::unique_ptr<blink::WebFrameScheduler> createFrameScheduler( 43 std::unique_ptr<blink::WebFrameScheduler> createFrameScheduler(
45 blink::BlameContext* blame_context) override; 44 blink::BlameContext* blame_context) override;
46 void enableVirtualTime() override; 45 void enableVirtualTime() override;
47 bool virtualTimeAllowedToAdvance() const override; 46 bool virtualTimeAllowedToAdvance() const override;
48 void setVirtualTimePolicy(VirtualTimePolicy virtual_time_policy) override; 47 void setVirtualTimePolicy(VirtualTimePolicy virtual_time_policy) override;
49 48
50 // Virtual for testing. 49 // Virtual for testing.
51 virtual void AddConsoleWarning(const std::string& message); 50 virtual void AddConsoleWarning(const std::string& message);
52 51
53 std::unique_ptr<WebFrameSchedulerImpl> createWebFrameSchedulerImpl( 52 std::unique_ptr<WebFrameSchedulerImpl> createWebFrameSchedulerImpl(
54 base::trace_event::BlameContext* blame_context); 53 base::trace_event::BlameContext* blame_context);
55 54
56 void DidStartLoading(unsigned long identifier); 55 void DidStartLoading(unsigned long identifier);
57 void DidStopLoading(unsigned long identifier); 56 void DidStopLoading(unsigned long identifier);
57 void Unregister(WebFrameSchedulerImpl* frame_scheduler);
58 58
59 private: 59 private:
60 friend class WebFrameSchedulerImpl;
61
62 void Unregister(WebFrameSchedulerImpl* frame_scheduler);
63
64 AutoAdvancingVirtualTimeDomain* virtual_time_domain() const {
65 return virtual_time_domain_.get();
66 }
67
68 void setAllowVirtualTimeToAdvance(bool allow_virtual_time_to_advance); 60 void setAllowVirtualTimeToAdvance(bool allow_virtual_time_to_advance);
69 61
70 std::set<WebFrameSchedulerImpl*> frame_schedulers_; 62 std::set<WebFrameSchedulerImpl*> frame_schedulers_;
71 std::set<unsigned long> pending_loads_; 63 std::set<unsigned long> pending_loads_;
72 std::unique_ptr<AutoAdvancingVirtualTimeDomain> virtual_time_domain_;
73 TaskQueue::PumpPolicy virtual_time_pump_policy_;
74 blink::WebView* web_view_; 64 blink::WebView* web_view_;
75 RendererSchedulerImpl* renderer_scheduler_; 65 RendererSchedulerImpl* renderer_scheduler_;
76 VirtualTimePolicy virtual_time_policy_; 66 VirtualTimePolicy virtual_time_policy_;
77 bool page_visible_; 67 bool page_visible_;
78 bool disable_background_timer_throttling_; 68 bool disable_background_timer_throttling_;
79 bool allow_virtual_time_to_advance_; 69 bool allow_virtual_time_to_advance_;
70 bool have_seen_loading_task_;
71 bool virtual_time_;
80 72
81 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl); 73 DISALLOW_COPY_AND_ASSIGN(WebViewSchedulerImpl);
82 }; 74 };
83 75
84 } // namespace scheduler 76 } // namespace scheduler
85 77
86 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_ 78 #endif // COMPONENTS_SCHEDULER_RENDERER_WEB_VIEW_SCHEDULER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698