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

Unified Diff: chrome/browser/extensions/activity_log/activity_log.h

Issue 15573003: New architecture of the activity logging: Policies for summarization (and compression) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compiler errors on different platforms (at least I hope so). Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/activity_log/activity_log.h
diff --git a/chrome/browser/extensions/activity_log/activity_log.h b/chrome/browser/extensions/activity_log/activity_log.h
index b934d97e3ee82d31ebf71258f2a37eb638ecac00..54b6fa2c772ba6a742655131850fd40ae5d5aa36 100644
--- a/chrome/browser/extensions/activity_log/activity_log.h
+++ b/chrome/browser/extensions/activity_log/activity_log.h
@@ -9,8 +9,6 @@
#include <string>
#include <vector>
-#include "base/bind.h"
-#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/hash_tables.h"
#include "base/memory/singleton.h"
@@ -24,13 +22,13 @@
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
-#include "content/public/browser/browser_thread.h"
class Profile;
using content::BrowserThread;
namespace extensions {
class Extension;
+class ActivityLogPolicy;
// A utility for tracing interesting activity for each extension.
// It writes to an ActivityDatabase on a separate thread to record the activity.
@@ -95,7 +93,7 @@ class ActivityLog : public ProfileKeyedService,
void LogBlockedAction(const Extension* extension,
const std::string& blocked_call, // e.g., tabs.get
ListValue* args, // argument values
- const BlockedAction::Reason reason, // why it's blocked
+ BlockedAction::Reason reason, // why it's blocked
const std::string& extra); // extra logging info
// Log an interaction between an extension and a URL.
@@ -127,10 +125,6 @@ class ActivityLog : public ProfileKeyedService,
<void(scoped_ptr<std::vector<scoped_refptr<Action> > >)>&
callback);
- // An error has happened; we want to rollback and close the db.
- // Needs to be public so the error delegate can call it.
- void KillActivityLogDatabase();
-
// For unit tests only.
void SetArgumentLoggingForTesting(bool log_arguments);
@@ -167,51 +161,17 @@ class ActivityLog : public ProfileKeyedService,
int32 page_id,
const GURL& on_url) OVERRIDE;
- // The callback when initializing the database.
- void OnDBInitComplete();
-
static const char* ActivityToString(Activity activity);
- // The Schedule methods dispatch the calls to the database on a
- // separate thread. We dispatch to the UI thread if the DB thread doesn't
- // exist, which should only happen in tests where there is no DB thread.
- template<typename DatabaseFunc>
- void ScheduleAndForget(DatabaseFunc func) {
- BrowserThread::PostTask(dispatch_thread_,
- FROM_HERE,
- base::Bind(func, base::Unretained(db_)));
- }
-
- template<typename DatabaseFunc, typename ArgA>
- void ScheduleAndForget(DatabaseFunc func, ArgA a) {
- BrowserThread::PostTask(dispatch_thread_,
- FROM_HERE,
- base::Bind(func, base::Unretained(db_), a));
- }
-
- template<typename DatabaseFunc, typename ArgA, typename ArgB>
- void ScheduleAndForget(DatabaseFunc func, ArgA a, ArgB b) {
- BrowserThread::PostTask(dispatch_thread_,
- FROM_HERE,
- base::Bind(func, base::Unretained(db_), a, b));
- }
-
typedef ObserverListThreadSafe<Observer> ObserverList;
typedef std::map<const Extension*, scoped_refptr<ObserverList> >
ObserverMap;
// A map of extensions to activity observers for that extension.
ObserverMap observers_;
- // The database wrapper that does the actual database I/O.
- // We initialize this on the same thread as the ActivityLog, but then
- // subsequent operations occur on the DB thread. Instead of destructing the
- // ActivityDatabase, we call its Close() method on the DB thread and it
- // commits suicide.
- extensions::ActivityDatabase* db_;
-
- // Normally the DB thread. In some cases (tests), it might not exist
- // we dispatch to the UI thread.
- BrowserThread::ID dispatch_thread_;
+ // The policy object takes care of data summarization, compression, and
+ // logging
+ extensions::ActivityLogPolicy* policy_;
// Whether to log activity to stdout or the UI. These are set by switches.
bool log_activity_to_stdout_;

Powered by Google App Engine
This is Rietveld 408576698