OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ |
| 6 #define COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/page_load_metrics/common/page_load_timing.h" |
| 11 |
| 12 namespace base { |
| 13 class Timer; |
| 14 } // namespace base |
| 15 |
| 16 namespace IPC { |
| 17 class Sender; |
| 18 } // namespace IPC |
| 19 |
| 20 namespace page_load_metrics { |
| 21 |
| 22 // PageTimingMetricsSender is responsible for sending page load timing metrics |
| 23 // over IPC. PageTimingMetricsSender may coalesce sent IPCs in order to |
| 24 // minimize IPC contention. |
| 25 class PageTimingMetricsSender { |
| 26 public: |
| 27 PageTimingMetricsSender(IPC::Sender* ipc_sender, |
| 28 int routing_id, |
| 29 scoped_ptr<base::Timer> timer); |
| 30 ~PageTimingMetricsSender(); |
| 31 |
| 32 void Send(const PageLoadTiming& timing); |
| 33 |
| 34 protected: |
| 35 base::Timer* timer() const { return timer_.get(); } |
| 36 |
| 37 private: |
| 38 void SendNow(); |
| 39 |
| 40 IPC::Sender* const ipc_sender_; |
| 41 const int routing_id_; |
| 42 scoped_ptr<base::Timer> timer_; |
| 43 PageLoadTiming last_timing_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(PageTimingMetricsSender); |
| 46 }; |
| 47 |
| 48 } // namespace page_load_metrics |
| 49 |
| 50 #endif // COMPONENTS_PAGE_LOAD_METRICS_RENDERER_PAGE_TIMING_METRICS_SENDER_H_ |
OLD | NEW |