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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h

Issue 775773002: Add data reduction proxy debug info to net-internals#bandwidth (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h
index f8517a4e8f5da085be2911df41cd7e296a80de0e..5feb500120f3f6fec316b9e479ffa3f7358e646d 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_event_store.h
@@ -11,6 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
+#include "net/base/net_log.h"
class GURL;
@@ -27,6 +28,13 @@ class NetLog;
namespace data_reduction_proxy {
+enum DataReductionProxyCanaryState {
+ CANARY_UNKNOWN,
+ CANARY_PENDING,
+ CANARY_SUCCESS,
+ CANARY_FAILED,
+};
+
class DataReductionProxyEventStore {
public:
// Constructs a DataReductionProxyEventStore object with the given network
@@ -75,6 +83,11 @@ class DataReductionProxyEventStore {
// when the canary request has ended.
void EndCanaryRequest(const net::BoundNetLog& net_log, int net_error);
+ // Adds stored events to an existing DictionaryValue to return to the caller.
+ // The caller takes ownership of all values added to the DictionaryValue.
+ void AddStoredEvents(
+ base::DictionaryValue* data_reduction_proxy_values) const;
bengr 2014/12/02 23:55:33 Can this fit on the previous line?
jeremyim 2014/12/03 08:10:37 Not quite =\
+
private:
friend class DataReductionProxyEventStoreTest;
FRIEND_TEST_ALL_PREFIXES(DataReductionProxyEventStoreTest,
@@ -90,26 +103,61 @@ class DataReductionProxyEventStore {
FRIEND_TEST_ALL_PREFIXES(DataReductionProxyEventStoreTest,
TestEndCanaryRequest);
- // Prepare and post an event for the event_store on the global net_log.
- void PostGlobalNetLogEvent(net::NetLog* net_log,
- net::NetLog::EventType type,
- const net::NetLog::ParametersCallback& callback);
+ // Prepare and post enabling/disabling proxy event for the event_store on the
bengr 2014/12/02 23:55:32 events?
jeremyim 2014/12/03 08:10:37 Done.
+ // global net_log.
+ void PostEnabledEvent(net::NetLog* net_log,
+ net::NetLog::EventType type,
+ bool enable,
+ const net::NetLog::ParametersCallback& callback);
- // Prepare and post an event for the event_store on a BoundNetLog.
- void PostBoundNetLogEvent(const net::BoundNetLog& net_log,
- net::NetLog::EventType type,
- net::NetLog::EventPhase phase,
- const net::NetLog::ParametersCallback& callback);
+ // Prepare and post a data reduction proxy bypass event for the event_store
bengr 2014/12/02 23:55:33 remove extra space before "event"
jeremyim 2014/12/03 08:10:37 Done.
+ // on a BoundNetLog.
+ void PostBoundNetLogBypassEvent(
+ const net::BoundNetLog& net_log,
+ net::NetLog::EventType type,
+ net::NetLog::EventPhase phase,
+ int64 expiration_ticks,
+ const net::NetLog::ParametersCallback& callback);
+
+ // Prepare and post a canary request event for the event_store on a
+ // BoundNetLog.
+ void PostBoundNetLogCanaryEvent(
+ const net::BoundNetLog& net_log,
+ net::NetLog::EventType type,
+ net::NetLog::EventPhase phase,
+ DataReductionProxyCanaryState state,
+ const net::NetLog::ParametersCallback& callback);
// Put |entry| on a deque of events to store
void AddEventOnIOThread(scoped_ptr<base::Value> entry);
+ // Put |entry| on the deque of stored events and set |current_configuration_|.
+ void AddEnabledEventOnIOThread(scoped_ptr<base::Value> entry,
+ bool enabled);
+
+ // Put |entry| on a deque of events to store and set |canary_state_|
+ void AddEventAndCanaryStateOnIOThread(scoped_ptr<base::Value> entry,
+ DataReductionProxyCanaryState state);
+
+ // Put |entry| on a deque of events to store and set |last_bypass_event_| and
+ // |expiration_ticks_|
+ void AddAndSetLastBypassEventOnIOThread(scoped_ptr<base::Value> entry,
+ int64 expiration_ticks);
+
// A task runner to ensure that all reads/writes to |stored_events_| takes
// place on the IO thread.
scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
// A deque of data reduction proxy related events. It is used as a circular
// buffer to prevent unbounded memory utilization.
std::deque<base::Value*> stored_events_;
+ // The current data reduction proxy configuration
+ scoped_ptr<base::Value> current_configuration_;
+ // The state based on the last canary request.
+ DataReductionProxyCanaryState canary_state_;
+ // The last seen data reduction proxy bypass event.
+ scoped_ptr<base::Value> last_bypass_event_;
+ // The expiration time of the |last_bypass_event_|.
+ int64 expiration_ticks_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyEventStore);
};

Powered by Google App Engine
This is Rietveld 408576698