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

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

Issue 1857443002: Plumb experiment flags through page_load_metrics and add a new observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page_load_experiments
Patch Set: remove todo and fix up a test script Created 4 years, 8 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_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_
6 #define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ 6 #define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "components/page_load_metrics/common/page_load_timing.h" 10 #include "components/page_load_metrics/common/page_load_timing.h"
11 #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
11 12
12 namespace base { 13 namespace base {
13 class Timer; 14 class Timer;
14 } // namespace base 15 } // namespace base
15 16
16 namespace IPC { 17 namespace IPC {
17 class Sender; 18 class Sender;
18 } // namespace IPC 19 } // namespace IPC
19 20
20 namespace page_load_metrics { 21 namespace page_load_metrics {
21 22
22 // PageTimingMetricsSender is responsible for sending page load timing metrics 23 // PageTimingMetricsSender is responsible for sending page load timing metrics
23 // over IPC. PageTimingMetricsSender may coalesce sent IPCs in order to 24 // over IPC. PageTimingMetricsSender may coalesce sent IPCs in order to
24 // minimize IPC contention. 25 // minimize IPC contention.
25 class PageTimingMetricsSender { 26 class PageTimingMetricsSender {
26 public: 27 public:
27 PageTimingMetricsSender(IPC::Sender* ipc_sender, 28 PageTimingMetricsSender(IPC::Sender* ipc_sender,
28 int routing_id, 29 int routing_id,
29 scoped_ptr<base::Timer> timer); 30 scoped_ptr<base::Timer> timer);
30 ~PageTimingMetricsSender(); 31 ~PageTimingMetricsSender();
31 32
33 void DidObserveLoadingBehavior(blink::WebLoadingBehaviorFlag behavior);
32 void Send(const PageLoadTiming& timing); 34 void Send(const PageLoadTiming& timing);
33 35
34 protected: 36 protected:
35 base::Timer* timer() const { return timer_.get(); } 37 base::Timer* timer() const { return timer_.get(); }
36 38
37 private: 39 private:
40 void EnsureSendTimer();
38 void SendNow(); 41 void SendNow();
39 42
40 IPC::Sender* const ipc_sender_; 43 IPC::Sender* const ipc_sender_;
41 const int routing_id_; 44 const int routing_id_;
42 scoped_ptr<base::Timer> timer_; 45 scoped_ptr<base::Timer> timer_;
43 PageLoadTiming last_timing_; 46 PageLoadTiming last_timing_;
44 47
48 // The the sender keep track of metadata as it comes in, because the sender is
49 // scoped to a single committed load.
50 PageLoadMetadata metadata_;
51
45 DISALLOW_COPY_AND_ASSIGN(PageTimingMetricsSender); 52 DISALLOW_COPY_AND_ASSIGN(PageTimingMetricsSender);
46 }; 53 };
47 54
48 } // namespace page_load_metrics 55 } // namespace page_load_metrics
49 56
50 #endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ 57 #endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698