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

Side by Side Diff: Source/modules/indexeddb/IDBDatabase.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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 #endif 100 #endif
101 visitor->trace(m_databaseCallbacks); 101 visitor->trace(m_databaseCallbacks);
102 RefCountedGarbageCollectedEventTargetWithInlineData<IDBDatabase>::trace(visi tor); 102 RefCountedGarbageCollectedEventTargetWithInlineData<IDBDatabase>::trace(visi tor);
103 ActiveDOMObject::trace(visitor); 103 ActiveDOMObject::trace(visitor);
104 } 104 }
105 105
106 int64_t IDBDatabase::nextTransactionId() 106 int64_t IDBDatabase::nextTransactionId()
107 { 107 {
108 // Only keep a 32-bit counter to allow ports to use the other 32 108 // Only keep a 32-bit counter to allow ports to use the other 32
109 // bits of the id. 109 // bits of the id.
110 AtomicallyInitializedStatic(int, currentTransactionId = 0); 110 static int currentTransactionId = 0;
111 return atomicIncrement(&currentTransactionId); 111 return atomicIncrement(&currentTransactionId);
112 } 112 }
113 113
114 void IDBDatabase::ackReceivedBlobs(const Vector<String>& uuids) 114 void IDBDatabase::ackReceivedBlobs(const Vector<String>& uuids)
115 { 115 {
116 if (!m_backend) 116 if (!m_backend)
117 return; 117 return;
118 m_backend->ackReceivedBlobs(uuids); 118 m_backend->ackReceivedBlobs(uuids);
119 } 119 }
120 120
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 { 450 {
451 return EventTargetNames::IDBDatabase; 451 return EventTargetNames::IDBDatabase;
452 } 452 }
453 453
454 ExecutionContext* IDBDatabase::executionContext() const 454 ExecutionContext* IDBDatabase::executionContext() const
455 { 455 {
456 return ActiveDOMObject::executionContext(); 456 return ActiveDOMObject::executionContext();
457 } 457 }
458 458
459 } // namespace blink 459 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698