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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseManager.cpp

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 9 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) 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 InspectorInstrumentation::AsyncTask asyncTask(database->getExecutionContext(), 66 InspectorInstrumentation::AsyncTask asyncTask(database->getExecutionContext(),
67 callback); 67 callback);
68 callback->handleEvent(database); 68 callback->handleEvent(database);
69 } 69 }
70 70
71 DatabaseContext* DatabaseManager::existingDatabaseContextFor( 71 DatabaseContext* DatabaseManager::existingDatabaseContextFor(
72 ExecutionContext* context) { 72 ExecutionContext* context) {
73 ASSERT(m_databaseContextRegisteredCount >= 0); 73 ASSERT(m_databaseContextRegisteredCount >= 0);
74 ASSERT(m_databaseContextInstanceCount >= 0); 74 ASSERT(m_databaseContextInstanceCount >= 0);
75 ASSERT(m_databaseContextRegisteredCount <= m_databaseContextInstanceCount); 75 ASSERT(m_databaseContextRegisteredCount <= m_databaseContextInstanceCount);
76 return m_contextMap.get(context); 76 return m_contextMap.at(context);
77 } 77 }
78 78
79 DatabaseContext* DatabaseManager::databaseContextFor( 79 DatabaseContext* DatabaseManager::databaseContextFor(
80 ExecutionContext* context) { 80 ExecutionContext* context) {
81 if (DatabaseContext* databaseContext = existingDatabaseContextFor(context)) 81 if (DatabaseContext* databaseContext = existingDatabaseContextFor(context))
82 return databaseContext; 82 return databaseContext;
83 return DatabaseContext::create(context); 83 return DatabaseContext::create(context);
84 } 84 }
85 85
86 void DatabaseManager::registerDatabaseContext( 86 void DatabaseManager::registerDatabaseContext(
87 DatabaseContext* databaseContext) { 87 DatabaseContext* databaseContext) {
88 ExecutionContext* context = databaseContext->getExecutionContext(); 88 ExecutionContext* context = databaseContext->getExecutionContext();
89 m_contextMap.set(context, databaseContext); 89 m_contextMap.set(context, databaseContext);
90 #if DCHECK_IS_ON() 90 #if DCHECK_IS_ON()
91 m_databaseContextRegisteredCount++; 91 m_databaseContextRegisteredCount++;
92 #endif 92 #endif
93 } 93 }
94 94
95 void DatabaseManager::unregisterDatabaseContext( 95 void DatabaseManager::unregisterDatabaseContext(
96 DatabaseContext* databaseContext) { 96 DatabaseContext* databaseContext) {
97 ExecutionContext* context = databaseContext->getExecutionContext(); 97 ExecutionContext* context = databaseContext->getExecutionContext();
98 ASSERT(m_contextMap.get(context)); 98 ASSERT(m_contextMap.at(context));
99 #if DCHECK_IS_ON() 99 #if DCHECK_IS_ON()
100 m_databaseContextRegisteredCount--; 100 m_databaseContextRegisteredCount--;
101 #endif 101 #endif
102 m_contextMap.erase(context); 102 m_contextMap.erase(context);
103 } 103 }
104 104
105 #if DCHECK_IS_ON() 105 #if DCHECK_IS_ON()
106 void DatabaseManager::didConstructDatabaseContext() { 106 void DatabaseManager::didConstructDatabaseContext() {
107 m_databaseContextInstanceCount++; 107 m_databaseContextInstanceCount++;
108 } 108 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 createIfDoesNotExist); 218 createIfDoesNotExist);
219 } 219 }
220 220
221 void DatabaseManager::logErrorMessage(ExecutionContext* context, 221 void DatabaseManager::logErrorMessage(ExecutionContext* context,
222 const String& message) { 222 const String& message) {
223 context->addConsoleMessage( 223 context->addConsoleMessage(
224 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message)); 224 ConsoleMessage::create(StorageMessageSource, ErrorMessageLevel, message));
225 } 225 }
226 226
227 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698