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

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

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 { 52 {
53 if (Platform::current()->databaseObserver()) { 53 if (Platform::current()->databaseObserver()) {
54 Platform::current()->databaseObserver()->databaseClosed( 54 Platform::current()->databaseObserver()->databaseClosed(
55 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin( )), 55 createDatabaseIdentifierFromSecurityOrigin(database->securityOrigin( )),
56 database->stringIdentifier()); 56 database->stringIdentifier());
57 } 57 }
58 } 58 }
59 59
60 DatabaseTracker& DatabaseTracker::tracker() 60 DatabaseTracker& DatabaseTracker::tracker()
61 { 61 {
62 AtomicallyInitializedStatic(DatabaseTracker&, tracker = *new DatabaseTracker ()); 62 AtomicallyInitializedStaticReference(DatabaseTracker, tracker, new DatabaseT racker);
63 return tracker; 63 return tracker;
64 } 64 }
65 65
66 DatabaseTracker::DatabaseTracker() 66 DatabaseTracker::DatabaseTracker()
67 { 67 {
68 SQLiteFileSystem::registerSQLiteVFS(); 68 SQLiteFileSystem::registerSQLiteVFS();
69 } 69 }
70 70
71 bool DatabaseTracker::canEstablishDatabase(DatabaseContext* databaseContext, con st String& name, const String& displayName, unsigned long estimatedSize, Databas eError& error) 71 bool DatabaseTracker::canEstablishDatabase(DatabaseContext* databaseContext, con st String& name, const String& displayName, unsigned long estimatedSize, Databas eError& error)
72 { 72 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 DatabaseSet::iterator found = databaseSet->find(database); 261 DatabaseSet::iterator found = databaseSet->find(database);
262 if (found == databaseSet->end()) 262 if (found == databaseSet->end())
263 return; 263 return;
264 } 264 }
265 265
266 // And we have to call closeImmediately() without our collection lock being held. 266 // And we have to call closeImmediately() without our collection lock being held.
267 database->closeImmediately(); 267 database->closeImmediately();
268 } 268 }
269 269
270 } // namespace blink 270 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698