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

Side by Side Diff: chrome/browser/extensions/activity_log/fullstream_ui_policy.h

Issue 21646004: Compressed activity log database storage (Closed) Base URL: http://git.chromium.org/chromium/src.git@refactor-cleanups
Patch Set: Created 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/extensions/activity_log/activity_database.h" 10 #include "chrome/browser/extensions/activity_log/activity_database.h"
11 #include "chrome/browser/extensions/activity_log/activity_log_policy.h" 11 #include "chrome/browser/extensions/activity_log/activity_log_policy.h"
12 #include "chrome/browser/extensions/activity_log/database_interned_string.h"
12 13
13 class GURL; 14 class GURL;
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 // A policy for logging the full stream of actions, including all arguments. 18 // A policy for logging the full stream of actions, including all arguments.
18 // It's mostly intended to be used in testing and analysis. 19 // It's mostly intended to be used in testing and analysis.
19 class FullStreamUIPolicy : public ActivityLogDatabasePolicy { 20 class FullStreamUIPolicy : public ActivityLogDatabasePolicy {
20 public: 21 public:
21 // For more info about these member functions, see the super class. 22 // For more info about these member functions, see the super class.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE; 57 virtual bool FlushDatabase(sql::Connection* db) OVERRIDE;
57 virtual void OnDatabaseFailure() OVERRIDE; 58 virtual void OnDatabaseFailure() OVERRIDE;
58 virtual void OnDatabaseClose() OVERRIDE; 59 virtual void OnDatabaseClose() OVERRIDE;
59 60
60 // Strips arguments if needed by policy. May return the original object (if 61 // Strips arguments if needed by policy. May return the original object (if
61 // unmodified), or a copy (if modifications were made). The implementation 62 // unmodified), or a copy (if modifications were made). The implementation
62 // in FullStreamUIPolicy returns the action unmodified. 63 // in FullStreamUIPolicy returns the action unmodified.
63 virtual scoped_refptr<Action> ProcessArguments( 64 virtual scoped_refptr<Action> ProcessArguments(
64 scoped_refptr<Action> action) const; 65 scoped_refptr<Action> action) const;
65 66
67 // Tables for mapping strings to integers for shrinking database storage
68 // requirements. URLs are kept in a separate table from other strings to
69 // make history clearing simpler.
70 DatabaseStringTable string_table_;
71 DatabaseStringTable url_table_;
72
66 // Tracks any pending updates to be written to the database, if write 73 // Tracks any pending updates to be written to the database, if write
67 // batching is turned on. Should only be accessed from the database thread. 74 // batching is turned on. Should only be accessed from the database thread.
68 Action::ActionVector queued_actions_; 75 Action::ActionVector queued_actions_;
69 76
70 private: 77 private:
71 // Adds an Action to queued_actions_; this should be invoked only on the 78 // Adds an Action to queued_actions_; this should be invoked only on the
72 // database thread. 79 // database thread.
73 void QueueAction(scoped_refptr<Action> action); 80 void QueueAction(scoped_refptr<Action> action);
74 81
75 // The implementation of ReadData; this must only run on the database thread. 82 // The implementation of ReadData; this must only run on the database thread.
76 scoped_ptr<Action::ActionVector> DoReadData(const std::string& extension_id, 83 scoped_ptr<Action::ActionVector> DoReadData(const std::string& extension_id,
77 const int days_ago); 84 const int days_ago);
78 }; 85 };
79 86
80 } // namespace extensions 87 } // namespace extensions
81 88
82 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_ 89 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_FULLSTREAM_UI_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698