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

Side by Side Diff: Source/modules/indexeddb/IDBFactory.cpp

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
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 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "modules/indexeddb/IDBFactory.h" 30 #include "modules/indexeddb/IDBFactory.h"
31 31
32 #include "bindings/v8/ExceptionMessages.h" 32 #include "bindings/v8/ExceptionMessages.h"
33 #include "bindings/v8/ExceptionState.h" 33 #include "bindings/v8/ExceptionState.h"
34 #include "bindings/v8/IDBBindingUtilities.h" 34 #include "bindings/v8/IDBBindingUtilities.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
37 #include "core/platform/HistogramSupport.h"
38 #include "modules/indexeddb/IDBDatabase.h" 37 #include "modules/indexeddb/IDBDatabase.h"
39 #include "modules/indexeddb/IDBDatabaseCallbacksImpl.h" 38 #include "modules/indexeddb/IDBDatabaseCallbacksImpl.h"
40 #include "modules/indexeddb/IDBFactoryBackendInterface.h" 39 #include "modules/indexeddb/IDBFactoryBackendInterface.h"
41 #include "modules/indexeddb/IDBHistograms.h" 40 #include "modules/indexeddb/IDBHistograms.h"
42 #include "modules/indexeddb/IDBKey.h" 41 #include "modules/indexeddb/IDBKey.h"
43 #include "modules/indexeddb/IDBOpenDBRequest.h" 42 #include "modules/indexeddb/IDBOpenDBRequest.h"
44 #include "modules/indexeddb/IDBTracing.h" 43 #include "modules/indexeddb/IDBTracing.h"
44 #include "public/platform/Platform.h"
45 #include "weborigin/DatabaseIdentifier.h" 45 #include "weborigin/DatabaseIdentifier.h"
46 #include "weborigin/SecurityOrigin.h" 46 #include "weborigin/SecurityOrigin.h"
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 IDBFactory::IDBFactory(IDBFactoryBackendInterface* factory) 50 IDBFactory::IDBFactory(IDBFactoryBackendInterface* factory)
51 : m_backend(factory) 51 : m_backend(factory)
52 { 52 {
53 // We pass a reference to this object before it can be adopted. 53 // We pass a reference to this object before it can be adopted.
54 relaxAdoptionRequirement(); 54 relaxAdoptionRequirement();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 IDB_TRACE("IDBFactory::open"); 89 IDB_TRACE("IDBFactory::open");
90 if (!version) { 90 if (!version) {
91 es.throwUninformativeAndGenericTypeError(); 91 es.throwUninformativeAndGenericTypeError();
92 return 0; 92 return 0;
93 } 93 }
94 return openInternal(context, name, version, es); 94 return openInternal(context, name, version, es);
95 } 95 }
96 96
97 PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ExecutionContext* context, const String& name, int64_t version, ExceptionState& es) 97 PassRefPtr<IDBOpenDBRequest> IDBFactory::openInternal(ExecutionContext* context, const String& name, int64_t version, ExceptionState& es)
98 { 98 {
99 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBOpenCall, IDBMethodsMax); 99 WebKit::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEn dAPICalls", IDBOpenCall, IDBMethodsMax);
100 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion); 100 ASSERT(version >= 1 || version == IDBDatabaseMetadata::NoIntVersion);
101 if (name.isNull()) { 101 if (name.isNull()) {
102 es.throwUninformativeAndGenericTypeError(); 102 es.throwUninformativeAndGenericTypeError();
103 return 0; 103 return 0;
104 } 104 }
105 if (!isContextValid(context)) 105 if (!isContextValid(context))
106 return 0; 106 return 0;
107 if (!context->securityOrigin()->canAccessDatabase()) { 107 if (!context->securityOrigin()->canAccessDatabase()) {
108 es.throwSecurityError(ExceptionMessages::failedToExecute("open", "IDBFac tory", "access to the Indexed Database API is denied in this context.")); 108 es.throwSecurityError(ExceptionMessages::failedToExecute("open", "IDBFac tory", "access to the Indexed Database API is denied in this context."));
109 return 0; 109 return 0;
110 } 110 }
111 111
112 RefPtr<IDBDatabaseCallbacksImpl> databaseCallbacks = IDBDatabaseCallbacksImp l::create(); 112 RefPtr<IDBDatabaseCallbacksImpl> databaseCallbacks = IDBDatabaseCallbacksImp l::create();
113 int64_t transactionId = IDBDatabase::nextTransactionId(); 113 int64_t transactionId = IDBDatabase::nextTransactionId();
114 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(context, databas eCallbacks, transactionId, version); 114 RefPtr<IDBOpenDBRequest> request = IDBOpenDBRequest::create(context, databas eCallbacks, transactionId, version);
115 m_backend->open(name, version, transactionId, request, databaseCallbacks, cr eateDatabaseIdentifierFromSecurityOrigin(context->securityOrigin()), context); 115 m_backend->open(name, version, transactionId, request, databaseCallbacks, cr eateDatabaseIdentifierFromSecurityOrigin(context->securityOrigin()), context);
116 return request; 116 return request;
117 } 117 }
118 118
119 PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ExecutionContext* context, const S tring& name, ExceptionState& es) 119 PassRefPtr<IDBOpenDBRequest> IDBFactory::open(ExecutionContext* context, const S tring& name, ExceptionState& es)
120 { 120 {
121 IDB_TRACE("IDBFactory::open"); 121 IDB_TRACE("IDBFactory::open");
122 return openInternal(context, name, IDBDatabaseMetadata::NoIntVersion, es); 122 return openInternal(context, name, IDBDatabaseMetadata::NoIntVersion, es);
123 } 123 }
124 124
125 PassRefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ExecutionContext* contex t, const String& name, ExceptionState& es) 125 PassRefPtr<IDBOpenDBRequest> IDBFactory::deleteDatabase(ExecutionContext* contex t, const String& name, ExceptionState& es)
126 { 126 {
127 IDB_TRACE("IDBFactory::deleteDatabase"); 127 IDB_TRACE("IDBFactory::deleteDatabase");
128 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBDeleteDatabaseCall, IDBMethodsMax); 128 WebKit::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEn dAPICalls", IDBDeleteDatabaseCall, IDBMethodsMax);
129 if (name.isNull()) { 129 if (name.isNull()) {
130 es.throwUninformativeAndGenericTypeError(); 130 es.throwUninformativeAndGenericTypeError();
131 return 0; 131 return 0;
132 } 132 }
133 if (!isContextValid(context)) 133 if (!isContextValid(context))
134 return 0; 134 return 0;
135 if (!context->securityOrigin()->canAccessDatabase()) { 135 if (!context->securityOrigin()->canAccessDatabase()) {
136 es.throwSecurityError(ExceptionMessages::failedToExecute("deleteDatabase ", "IDBFactory", "access to the Indexed Database API is denied in this context." )); 136 es.throwSecurityError(ExceptionMessages::failedToExecute("deleteDatabase ", "IDBFactory", "access to the Indexed Database API is denied in this context." ));
137 return 0; 137 return 0;
138 } 138 }
(...skipping 14 matching lines...) Expand all
153 153
154 if (!first->isValid() || !second->isValid()) { 154 if (!first->isValid() || !second->isValid()) {
155 es.throwDOMException(DataError, IDBDatabase::notValidKeyErrorMessage); 155 es.throwDOMException(DataError, IDBDatabase::notValidKeyErrorMessage);
156 return 0; 156 return 0;
157 } 157 }
158 158
159 return static_cast<short>(first->compare(second.get())); 159 return static_cast<short>(first->compare(second.get()));
160 } 160 }
161 161
162 } // namespace WebCore 162 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/websockets/WebSocketHandshake.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698