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

Side by Side Diff: chrome/renderer/page_load_metrics/page_timing_metrics_sender.h

Issue 2897243002: Revert of [Page Load Metrics] PageLoadMetrics Mojofication. (Closed)
Patch Set: Created 3 years, 7 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 CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_ 5 #ifndef CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_
6 #define CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_ 6 #define CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/common/page_load_metrics/page_load_timing.h" 11 #include "chrome/common/page_load_metrics/page_load_timing.h"
12 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" 12 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
13 13
14 namespace base { 14 namespace base {
15 class Timer; 15 class Timer;
16 } // namespace base 16 } // namespace base
17 17
18 namespace IPC {
19 class Sender;
20 } // namespace IPC
21
18 namespace page_load_metrics { 22 namespace page_load_metrics {
19 23
20 class PageTimingSender;
21
22 // PageTimingMetricsSender is responsible for sending page load timing metrics 24 // PageTimingMetricsSender is responsible for sending page load timing metrics
23 // over IPC. PageTimingMetricsSender may coalesce sent IPCs in order to 25 // over IPC. PageTimingMetricsSender may coalesce sent IPCs in order to
24 // minimize IPC contention. 26 // minimize IPC contention.
25 class PageTimingMetricsSender { 27 class PageTimingMetricsSender {
26 public: 28 public:
27 PageTimingMetricsSender(std::unique_ptr<PageTimingSender> sender, 29 PageTimingMetricsSender(IPC::Sender* ipc_sender,
30 int routing_id,
28 std::unique_ptr<base::Timer> timer, 31 std::unique_ptr<base::Timer> timer,
29 mojom::PageLoadTimingPtr initial_timing); 32 mojom::PageLoadTimingPtr initial_timing);
30 ~PageTimingMetricsSender(); 33 ~PageTimingMetricsSender();
31 34
32 void DidObserveLoadingBehavior(blink::WebLoadingBehaviorFlag behavior); 35 void DidObserveLoadingBehavior(blink::WebLoadingBehaviorFlag behavior);
33 void Send(mojom::PageLoadTimingPtr timing); 36 void Send(mojom::PageLoadTimingPtr timing);
34 37
35 protected: 38 protected:
36 base::Timer* timer() const { return timer_.get(); } 39 base::Timer* timer() const { return timer_.get(); }
37 40
38 private: 41 private:
39 void EnsureSendTimer(); 42 void EnsureSendTimer();
40 void SendNow(); 43 void SendNow();
41 44
42 std::unique_ptr<PageTimingSender> sender_; 45 IPC::Sender* const ipc_sender_;
46 const int routing_id_;
43 std::unique_ptr<base::Timer> timer_; 47 std::unique_ptr<base::Timer> timer_;
44 mojom::PageLoadTimingPtr last_timing_; 48 mojom::PageLoadTimingPtr last_timing_;
45 49
46 // The the sender keep track of metadata as it comes in, because the sender is 50 // The the sender keep track of metadata as it comes in, because the sender is
47 // scoped to a single committed load. 51 // scoped to a single committed load.
48 mojom::PageLoadMetadataPtr metadata_; 52 mojom::PageLoadMetadata metadata_;
49 53
50 bool have_sent_ipc_ = false; 54 bool have_sent_ipc_ = false;
51 55
52 DISALLOW_COPY_AND_ASSIGN(PageTimingMetricsSender); 56 DISALLOW_COPY_AND_ASSIGN(PageTimingMetricsSender);
53 }; 57 };
54 58
55 } // namespace page_load_metrics 59 } // namespace page_load_metrics
56 60
57 #endif // CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_ 61 #endif // CHROME_RENDERER_PAGE_LOAD_METRICS_PAGE_TIMING_METRICS_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698