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

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

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void SQLTransactionCoordinator::acquireLock(SQLTransactionBackend* transaction) 71 void SQLTransactionCoordinator::acquireLock(SQLTransactionBackend* transaction)
72 { 72 {
73 ASSERT(!m_isShuttingDown); 73 ASSERT(!m_isShuttingDown);
74 74
75 String dbIdentifier = getDatabaseIdentifier(transaction); 75 String dbIdentifier = getDatabaseIdentifier(transaction);
76 76
77 CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoM ap.find(dbIdentifier); 77 CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoM ap.find(dbIdentifier);
78 if (coordinationInfoIterator == m_coordinationInfoMap.end()) { 78 if (coordinationInfoIterator == m_coordinationInfoMap.end()) {
79 // No pending transactions for this DB 79 // No pending transactions for this DB
80 coordinationInfoIterator = m_coordinationInfoMap.add(dbIdentifier, Coord inationInfo()).iterator; 80 CoordinationInfo& info = m_coordinationInfoMap.add(dbIdentifier, Coordin ationInfo()).storedValue->value;
81 info.pendingTransactions.append(transaction);
82 processPendingTransactions(info);
83 } else {
84 CoordinationInfo& info = coordinationInfoIterator->value;
85 info.pendingTransactions.append(transaction);
86 processPendingTransactions(info);
81 } 87 }
82 88
83 CoordinationInfo& info = coordinationInfoIterator->value;
84 info.pendingTransactions.append(transaction);
85 processPendingTransactions(info);
86 } 89 }
87 90
88 void SQLTransactionCoordinator::releaseLock(SQLTransactionBackend* transaction) 91 void SQLTransactionCoordinator::releaseLock(SQLTransactionBackend* transaction)
89 { 92 {
90 if (m_isShuttingDown) 93 if (m_isShuttingDown)
91 return; 94 return;
92 95
93 String dbIdentifier = getDatabaseIdentifier(transaction); 96 String dbIdentifier = getDatabaseIdentifier(transaction);
94 97
95 CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoM ap.find(dbIdentifier); 98 CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoM ap.find(dbIdentifier);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 RefPtr<SQLTransactionBackend> transaction = info.pendingTransactions .first(); 140 RefPtr<SQLTransactionBackend> transaction = info.pendingTransactions .first();
138 transaction->notifyDatabaseThreadIsShuttingDown(); 141 transaction->notifyDatabaseThreadIsShuttingDown();
139 } 142 }
140 } 143 }
141 144
142 // Clean up all pending transactions for all databases 145 // Clean up all pending transactions for all databases
143 m_coordinationInfoMap.clear(); 146 m_coordinationInfoMap.clear();
144 } 147 }
145 148
146 } // namespace WebCore 149 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/webdatabase/QuotaTracker.cpp ('k') | Source/platform/exported/WebHTTPLoadInfo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698