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

Side by Side Diff: trunk/src/chrome/browser/extensions/activity_log/api_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/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/extensions/activity_log/api_actions.h" 9 #include "chrome/browser/extensions/activity_log/api_actions.h"
10 #include "chrome/browser/extensions/activity_log/api_name_constants.h" 10 #include "chrome/browser/extensions/activity_log/api_name_constants.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 } 180 }
181 // Now initialize the table. 181 // Now initialize the table.
182 return InitializeTableInternal(db, 182 return InitializeTableInternal(db,
183 kTableName, 183 kTableName,
184 kTableContentFields, 184 kTableContentFields,
185 kTableFieldTypes, 185 kTableFieldTypes,
186 arraysize(kTableContentFields)); 186 arraysize(kTableContentFields));
187 } 187 }
188 188
189 bool APIAction::Record(sql::Connection* db) { 189 void APIAction::Record(sql::Connection* db) {
190 std::string sql_str = "INSERT INTO " + std::string(kTableName) 190 std::string sql_str = "INSERT INTO " + std::string(kTableName)
191 + " (extension_id, time, api_type, api_call, args, extra) VALUES" 191 + " (extension_id, time, api_type, api_call, args, extra) VALUES"
192 " (?,?,?,?,?,?)"; 192 " (?,?,?,?,?,?)";
193 sql::Statement statement(db->GetCachedStatement( 193 sql::Statement statement(db->GetCachedStatement(
194 sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); 194 sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
195 statement.BindString(0, extension_id()); 195 statement.BindString(0, extension_id());
196 statement.BindInt64(1, time().ToInternalValue()); 196 statement.BindInt64(1, time().ToInternalValue());
197 statement.BindInt(2, static_cast<int>(type_)); 197 statement.BindInt(2, static_cast<int>(type_));
198 statement.BindString(3, APINameMap::GetInstance()->ApiToShortname(api_call_)); 198 statement.BindString(3, APINameMap::GetInstance()->ApiToShortname(api_call_));
199 statement.BindString(4, args_); 199 statement.BindString(4, args_);
200 statement.BindString(5, extra_); 200 statement.BindString(5, extra_);
201 if (!statement.Run()) { 201 if (!statement.Run())
202 LOG(ERROR) << "Activity log database I/O failed: " << sql_str; 202 LOG(ERROR) << "Activity log database I/O failed: " << sql_str;
203 statement.Clear();
204 return false;
205 }
206 return true;
207 } 203 }
208 204
209 // static 205 // static
210 void APIAction::LookupTabId(const std::string& api_call, 206 void APIAction::LookupTabId(const std::string& api_call,
211 ListValue* args, 207 ListValue* args,
212 Profile* profile) { 208 Profile* profile) {
213 if (api_call == "tabs.get" || // api calls, ID as int 209 if (api_call == "tabs.get" || // api calls, ID as int
214 api_call == "tabs.connect" || 210 api_call == "tabs.connect" ||
215 api_call == "tabs.sendMessage" || 211 api_call == "tabs.sendMessage" ||
216 api_call == "tabs.duplicate" || 212 api_call == "tabs.duplicate" ||
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 return "call"; 255 return "call";
260 case EVENT_CALLBACK: 256 case EVENT_CALLBACK:
261 return "event_callback"; 257 return "event_callback";
262 default: 258 default:
263 return "unknown_type"; 259 return "unknown_type";
264 } 260 }
265 } 261 }
266 262
267 } // namespace extensions 263 } // namespace extensions
268 264
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698