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

Side by Side Diff: trunk/src/chrome/browser/extensions/activity_log/dom_actions.cc

Issue 16756004: Revert 205059 "We were seeing ActivityLog memory leaks and assor..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/stringprintf.h" 6 #include "base/stringprintf.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/extensions/activity_log/dom_actions.h" 8 #include "chrome/browser/extensions/activity_log/dom_actions.h"
9 #include "chrome/browser/history/url_database.h" 9 #include "chrome/browser/history/url_database.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 // Now initialize the table. 100 // Now initialize the table.
101 bool initialized = InitializeTableInternal(db, 101 bool initialized = InitializeTableInternal(db,
102 kTableName, 102 kTableName,
103 kTableContentFields, 103 kTableContentFields,
104 kTableFieldTypes, 104 kTableFieldTypes,
105 arraysize(kTableContentFields)); 105 arraysize(kTableContentFields));
106 return initialized; 106 return initialized;
107 } 107 }
108 108
109 bool DOMAction::Record(sql::Connection* db) { 109 void DOMAction::Record(sql::Connection* db) {
110 std::string sql_str = "INSERT INTO " + std::string(kTableName) + 110 std::string sql_str = "INSERT INTO " + std::string(kTableName) +
111 " (extension_id, time, url_action_type, url, url_title, api_call, args," 111 " (extension_id, time, url_action_type, url, url_title, api_call, args,"
112 " extra) VALUES (?,?,?,?,?,?,?,?)"; 112 " extra) VALUES (?,?,?,?,?,?,?,?)";
113 sql::Statement statement(db->GetCachedStatement( 113 sql::Statement statement(db->GetCachedStatement(
114 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); 114 sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
115 statement.BindString(0, extension_id()); 115 statement.BindString(0, extension_id());
116 statement.BindInt64(1, time().ToInternalValue()); 116 statement.BindInt64(1, time().ToInternalValue());
117 statement.BindInt(2, static_cast<int>(verb_)); 117 statement.BindInt(2, static_cast<int>(verb_));
118 statement.BindString(3, history::URLDatabase::GURLToDatabaseURL(url_)); 118 statement.BindString(3, history::URLDatabase::GURLToDatabaseURL(url_));
119 statement.BindString16(4, url_title_); 119 statement.BindString16(4, url_title_);
120 statement.BindString(5, api_call_); 120 statement.BindString(5, api_call_);
121 statement.BindString(6, args_); 121 statement.BindString(6, args_);
122 statement.BindString(7, extra_); 122 statement.BindString(7, extra_);
123 if (!statement.Run()) { 123 if (!statement.Run())
124 LOG(ERROR) << "Activity log database I/O failed: " << sql_str; 124 LOG(ERROR) << "Activity log database I/O failed: " << sql_str;
125 statement.Clear();
126 return false;
127 }
128 return true;
129 } 125 }
130 126
131 std::string DOMAction::PrintForDebug() { 127 std::string DOMAction::PrintForDebug() {
132 if (verb_ == DomActionType::INSERTED) 128 if (verb_ == DomActionType::INSERTED)
133 return "Injected scripts (" + args_ + ") onto " 129 return "Injected scripts (" + args_ + ") onto "
134 + std::string(url_.spec()) + (extra_.empty() ? extra_ : " " + extra_); 130 + std::string(url_.spec()) + (extra_.empty() ? extra_ : " " + extra_);
135 else 131 else
136 return "DOM API CALL: " + api_call_ + ", ARGS: " + args_ + ", VERB: " 132 return "DOM API CALL: " + api_call_ + ", ARGS: " + args_ + ", VERB: "
137 + VerbAsString(); 133 + VerbAsString();
138 } 134 }
(...skipping 14 matching lines...) Expand all
153 return "webrequest"; 149 return "webrequest";
154 case DomActionType::MODIFIED: // legacy 150 case DomActionType::MODIFIED: // legacy
155 return "modified"; 151 return "modified";
156 default: 152 default:
157 NOTREACHED(); 153 NOTREACHED();
158 return NULL; 154 return NULL;
159 } 155 }
160 } 156 }
161 157
162 } // namespace extensions 158 } // namespace extensions
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/extensions/activity_log/dom_actions.h ('k') | trunk/src/tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698