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

Side by Side Diff: Source/modules/webdatabase/DatabaseServer.cpp

Issue 567453002: Web SQL: Make sure DatabaseManager is used only in the main thread. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | « Source/modules/webdatabase/DatabaseServer.h ('k') | Source/web/WebDatabase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "modules/webdatabase/DatabaseContext.h" 31 #include "modules/webdatabase/DatabaseContext.h"
32 #include "modules/webdatabase/DatabaseTracker.h" 32 #include "modules/webdatabase/DatabaseTracker.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 String DatabaseServer::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfDoesNotExist) 36 String DatabaseServer::fullPathForDatabase(SecurityOrigin* origin, const String& name, bool createIfDoesNotExist)
37 { 37 {
38 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf DoesNotExist); 38 return DatabaseTracker::tracker().fullPathForDatabase(origin, name, createIf DoesNotExist);
39 } 39 }
40 40
41 void DatabaseServer::closeDatabasesImmediately(const String& originIdentifier, c onst String& name)
42 {
43 DatabaseTracker::tracker().closeDatabasesImmediately(originIdentifier, name) ;
44 }
45
46 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::openDatabase(Databas eContext* backendContext, 41 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::openDatabase(Databas eContext* backendContext,
47 const String& name, const String& expectedVersion, const String& displayName , 42 const String& name, const String& expectedVersion, const String& displayName ,
48 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError &er ror, String& errorMessage) 43 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError &er ror, String& errorMessage)
49 { 44 {
50 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr; 45 RefPtrWillBeRawPtr<DatabaseBackendBase> database = nullptr;
51 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext, name, di splayName, estimatedSize, error)) 46 if (DatabaseTracker::tracker().canEstablishDatabase(backendContext, name, di splayName, estimatedSize, error))
52 database = createDatabase(backendContext, name, expectedVersion, display Name, estimatedSize, setVersionInNewDatabase, error, errorMessage); 47 database = createDatabase(backendContext, name, expectedVersion, display Name, estimatedSize, setVersionInNewDatabase, error, errorMessage);
53 return database.release(); 48 return database.release();
54 } 49 }
55 50
56 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::createDatabase(Datab aseContext* backendContext, 51 PassRefPtrWillBeRawPtr<DatabaseBackendBase> DatabaseServer::createDatabase(Datab aseContext* backendContext,
57 const String& name, const String& expectedVersion, const String& displayName , 52 const String& name, const String& expectedVersion, const String& displayName ,
58 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er ror, String& errorMessage) 53 unsigned long estimatedSize, bool setVersionInNewDatabase, DatabaseError& er ror, String& errorMessage)
59 { 54 {
60 RefPtrWillBeRawPtr<DatabaseBackendBase> database = adoptRefWillBeNoop(new Da tabase(backendContext, name, expectedVersion, displayName, estimatedSize)); 55 RefPtrWillBeRawPtr<DatabaseBackendBase> database = adoptRefWillBeNoop(new Da tabase(backendContext, name, expectedVersion, displayName, estimatedSize));
61 if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMes sage)) 56 if (!database->openAndVerifyVersion(setVersionInNewDatabase, error, errorMes sage))
62 return nullptr; 57 return nullptr;
63 return database.release(); 58 return database.release();
64 } 59 }
65 60
66 } // namespace blink 61 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/DatabaseServer.h ('k') | Source/web/WebDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698