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

Side by Side Diff: content/browser/renderer_host/database_message_filter.cc

Issue 12327022: Merge 183141 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | webkit/database/database_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/database_message_filter.h" 5 #include "content/browser/renderer_host/database_message_filter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 available = quota - usage; 277 available = quota - usage;
278 DatabaseHostMsg_GetSpaceAvailable::WriteReplyParams(reply_msg, available); 278 DatabaseHostMsg_GetSpaceAvailable::WriteReplyParams(reply_msg, available);
279 Send(reply_msg); 279 Send(reply_msg);
280 } 280 }
281 281
282 void DatabaseMessageFilter::OnDatabaseOpened(const string16& origin_identifier, 282 void DatabaseMessageFilter::OnDatabaseOpened(const string16& origin_identifier,
283 const string16& database_name, 283 const string16& database_name,
284 const string16& description, 284 const string16& description,
285 int64 estimated_size) { 285 int64 estimated_size) {
286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 286 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
287
288 if (!DatabaseUtil::IsValidOriginIdentifier(origin_identifier)) {
289 RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
290 BadMessageReceived();
291 return;
292 }
293
287 int64 database_size = 0; 294 int64 database_size = 0;
288 db_tracker_->DatabaseOpened(origin_identifier, database_name, description, 295 db_tracker_->DatabaseOpened(origin_identifier, database_name, description,
289 estimated_size, &database_size); 296 estimated_size, &database_size);
290 database_connections_.AddConnection(origin_identifier, database_name); 297 database_connections_.AddConnection(origin_identifier, database_name);
291 Send(new DatabaseMsg_UpdateSize(origin_identifier, database_name, 298 Send(new DatabaseMsg_UpdateSize(origin_identifier, database_name,
292 database_size)); 299 database_size));
293 } 300 }
294 301
295 void DatabaseMessageFilter::OnDatabaseModified( 302 void DatabaseMessageFilter::OnDatabaseModified(
296 const string16& origin_identifier, 303 const string16& origin_identifier,
(...skipping 21 matching lines...) Expand all
318 325
319 database_connections_.RemoveConnection(origin_identifier, database_name); 326 database_connections_.RemoveConnection(origin_identifier, database_name);
320 db_tracker_->DatabaseClosed(origin_identifier, database_name); 327 db_tracker_->DatabaseClosed(origin_identifier, database_name);
321 } 328 }
322 329
323 void DatabaseMessageFilter::OnHandleSqliteError( 330 void DatabaseMessageFilter::OnHandleSqliteError(
324 const string16& origin_identifier, 331 const string16& origin_identifier,
325 const string16& database_name, 332 const string16& database_name,
326 int error) { 333 int error) {
327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
335 if (!DatabaseUtil::IsValidOriginIdentifier(origin_identifier)) {
336 RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
337 BadMessageReceived();
338 return;
339 }
340
328 db_tracker_->HandleSqliteError(origin_identifier, database_name, error); 341 db_tracker_->HandleSqliteError(origin_identifier, database_name, error);
329 } 342 }
330 343
331 void DatabaseMessageFilter::OnDatabaseSizeChanged( 344 void DatabaseMessageFilter::OnDatabaseSizeChanged(
332 const string16& origin_identifier, 345 const string16& origin_identifier,
333 const string16& database_name, 346 const string16& database_name,
334 int64 database_size) { 347 int64 database_size) {
335 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 348 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
336 if (database_connections_.IsOriginUsed(origin_identifier)) { 349 if (database_connections_.IsOriginUsed(origin_identifier)) {
337 Send(new DatabaseMsg_UpdateSize(origin_identifier, database_name, 350 Send(new DatabaseMsg_UpdateSize(origin_identifier, database_name,
338 database_size)); 351 database_size));
339 } 352 }
340 } 353 }
341 354
342 void DatabaseMessageFilter::OnDatabaseScheduledForDeletion( 355 void DatabaseMessageFilter::OnDatabaseScheduledForDeletion(
343 const string16& origin_identifier, 356 const string16& origin_identifier,
344 const string16& database_name) { 357 const string16& database_name) {
345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
346 Send(new DatabaseMsg_CloseImmediately(origin_identifier, database_name)); 359 Send(new DatabaseMsg_CloseImmediately(origin_identifier, database_name));
347 } 360 }
348 361
349 } // namespace content 362 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | webkit/database/database_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698