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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/InspectorIndexedDBAgent.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 namespace IndexedDBAgentState { 82 namespace IndexedDBAgentState {
83 static const char indexedDBAgentEnabled[] = "indexedDBAgentEnabled"; 83 static const char indexedDBAgentEnabled[] = "indexedDBAgentEnabled";
84 }; 84 };
85 85
86 namespace { 86 namespace {
87 87
88 class GetDatabaseNamesCallback final : public EventListener { 88 class GetDatabaseNamesCallback final : public EventListener {
89 WTF_MAKE_NONCOPYABLE(GetDatabaseNamesCallback); 89 WTF_MAKE_NONCOPYABLE(GetDatabaseNamesCallback);
90 public: 90 public:
91 static PassRefPtrWillBeRawPtr<GetDatabaseNamesCallback> create(PassOwnPtr<Re questDatabaseNamesCallback> requestCallback, const String& securityOrigin) 91 static RawPtr<GetDatabaseNamesCallback> create(PassOwnPtr<RequestDatabaseNam esCallback> requestCallback, const String& securityOrigin)
92 { 92 {
93 return adoptRefWillBeNoop(new GetDatabaseNamesCallback(requestCallback, securityOrigin)); 93 return new GetDatabaseNamesCallback(requestCallback, securityOrigin);
94 } 94 }
95 95
96 ~GetDatabaseNamesCallback() override { } 96 ~GetDatabaseNamesCallback() override { }
97 97
98 bool operator==(const EventListener& other) const override 98 bool operator==(const EventListener& other) const override
99 { 99 {
100 return this == &other; 100 return this == &other;
101 } 101 }
102 102
103 void handleEvent(ExecutionContext*, Event* event) override 103 void handleEvent(ExecutionContext*, Event* event) override
104 { 104 {
105 if (event->type() != EventTypeNames::success) { 105 if (event->type() != EventTypeNames::success) {
106 m_requestCallback->sendFailure("Unexpected event type."); 106 m_requestCallback->sendFailure("Unexpected event type.");
107 return; 107 return;
108 } 108 }
109 109
110 IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target()); 110 IDBRequest* idbRequest = static_cast<IDBRequest*>(event->target());
111 IDBAny* requestResult = idbRequest->resultAsAny(); 111 IDBAny* requestResult = idbRequest->resultAsAny();
112 if (requestResult->getType() != IDBAny::DOMStringListType) { 112 if (requestResult->getType() != IDBAny::DOMStringListType) {
113 m_requestCallback->sendFailure("Unexpected result type."); 113 m_requestCallback->sendFailure("Unexpected result type.");
114 return; 114 return;
115 } 115 }
116 116
117 RefPtrWillBeRawPtr<DOMStringList> databaseNamesList = requestResult->dom StringList(); 117 RawPtr<DOMStringList> databaseNamesList = requestResult->domStringList() ;
118 OwnPtr<protocol::Array<String>> databaseNames = protocol::Array<String>: :create(); 118 OwnPtr<protocol::Array<String>> databaseNames = protocol::Array<String>: :create();
119 for (size_t i = 0; i < databaseNamesList->length(); ++i) 119 for (size_t i = 0; i < databaseNamesList->length(); ++i)
120 databaseNames->addItem(databaseNamesList->anonymousIndexedGetter(i)) ; 120 databaseNames->addItem(databaseNamesList->anonymousIndexedGetter(i)) ;
121 m_requestCallback->sendSuccess(databaseNames.release()); 121 m_requestCallback->sendSuccess(databaseNames.release());
122 } 122 }
123 123
124 DEFINE_INLINE_VIRTUAL_TRACE() 124 DEFINE_INLINE_VIRTUAL_TRACE()
125 { 125 {
126 EventListener::trace(visitor); 126 EventListener::trace(visitor);
127 } 127 }
(...skipping 16 matching lines...) Expand all
144 virtual void execute(IDBDatabase*) = 0; 144 virtual void execute(IDBDatabase*) = 0;
145 virtual RequestCallback* getRequestCallback() = 0; 145 virtual RequestCallback* getRequestCallback() = 0;
146 ExecutionContext* context() const { return m_scriptState->getExecutionContex t(); } 146 ExecutionContext* context() const { return m_scriptState->getExecutionContex t(); }
147 ScriptState* getScriptState() const { return m_scriptState.get(); } 147 ScriptState* getScriptState() const { return m_scriptState.get(); }
148 private: 148 private:
149 RefPtr<ScriptState> m_scriptState; 149 RefPtr<ScriptState> m_scriptState;
150 }; 150 };
151 151
152 class OpenDatabaseCallback final : public EventListener { 152 class OpenDatabaseCallback final : public EventListener {
153 public: 153 public:
154 static PassRefPtrWillBeRawPtr<OpenDatabaseCallback> create(ExecutableWithDat abase* executableWithDatabase) 154 static RawPtr<OpenDatabaseCallback> create(ExecutableWithDatabase* executabl eWithDatabase)
155 { 155 {
156 return adoptRefWillBeNoop(new OpenDatabaseCallback(executableWithDatabas e)); 156 return new OpenDatabaseCallback(executableWithDatabase);
157 } 157 }
158 158
159 ~OpenDatabaseCallback() override { } 159 ~OpenDatabaseCallback() override { }
160 160
161 bool operator==(const EventListener& other) const override 161 bool operator==(const EventListener& other) const override
162 { 162 {
163 return this == &other; 163 return this == &other;
164 } 164 }
165 165
166 void handleEvent(ExecutionContext* context, Event* event) override 166 void handleEvent(ExecutionContext* context, Event* event) override
(...skipping 18 matching lines...) Expand all
185 185
186 private: 186 private:
187 OpenDatabaseCallback(ExecutableWithDatabase* executableWithDatabase) 187 OpenDatabaseCallback(ExecutableWithDatabase* executableWithDatabase)
188 : EventListener(EventListener::CPPEventListenerType) 188 : EventListener(EventListener::CPPEventListenerType)
189 , m_executableWithDatabase(executableWithDatabase) { } 189 , m_executableWithDatabase(executableWithDatabase) { }
190 RefPtr<ExecutableWithDatabase> m_executableWithDatabase; 190 RefPtr<ExecutableWithDatabase> m_executableWithDatabase;
191 }; 191 };
192 192
193 class UpgradeDatabaseCallback final : public EventListener { 193 class UpgradeDatabaseCallback final : public EventListener {
194 public: 194 public:
195 static PassRefPtrWillBeRawPtr<UpgradeDatabaseCallback> create(ExecutableWith Database* executableWithDatabase) 195 static RawPtr<UpgradeDatabaseCallback> create(ExecutableWithDatabase* execut ableWithDatabase)
196 { 196 {
197 return adoptRefWillBeNoop(new UpgradeDatabaseCallback(executableWithData base)); 197 return new UpgradeDatabaseCallback(executableWithDatabase);
198 } 198 }
199 199
200 ~UpgradeDatabaseCallback() override { } 200 ~UpgradeDatabaseCallback() override { }
201 201
202 bool operator==(const EventListener& other) const override 202 bool operator==(const EventListener& other) const override
203 { 203 {
204 return this == &other; 204 return this == &other;
205 } 205 }
206 206
207 void handleEvent(ExecutionContext* context, Event* event) override 207 void handleEvent(ExecutionContext* context, Event* event) override
(...skipping 14 matching lines...) Expand all
222 222
223 private: 223 private:
224 UpgradeDatabaseCallback(ExecutableWithDatabase* executableWithDatabase) 224 UpgradeDatabaseCallback(ExecutableWithDatabase* executableWithDatabase)
225 : EventListener(EventListener::CPPEventListenerType) 225 : EventListener(EventListener::CPPEventListenerType)
226 , m_executableWithDatabase(executableWithDatabase) { } 226 , m_executableWithDatabase(executableWithDatabase) { }
227 RefPtr<ExecutableWithDatabase> m_executableWithDatabase; 227 RefPtr<ExecutableWithDatabase> m_executableWithDatabase;
228 }; 228 };
229 229
230 void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, cons t String& databaseName) 230 void ExecutableWithDatabase::start(IDBFactory* idbFactory, SecurityOrigin*, cons t String& databaseName)
231 { 231 {
232 RefPtrWillBeRawPtr<OpenDatabaseCallback> openCallback = OpenDatabaseCallback ::create(this); 232 RawPtr<OpenDatabaseCallback> openCallback = OpenDatabaseCallback::create(thi s);
233 RefPtrWillBeRawPtr<UpgradeDatabaseCallback> upgradeCallback = UpgradeDatabas eCallback::create(this); 233 RawPtr<UpgradeDatabaseCallback> upgradeCallback = UpgradeDatabaseCallback::c reate(this);
234 TrackExceptionState exceptionState; 234 TrackExceptionState exceptionState;
235 IDBOpenDBRequest* idbOpenDBRequest = idbFactory->open(getScriptState(), data baseName, exceptionState); 235 IDBOpenDBRequest* idbOpenDBRequest = idbFactory->open(getScriptState(), data baseName, exceptionState);
236 if (exceptionState.hadException()) { 236 if (exceptionState.hadException()) {
237 getRequestCallback()->sendFailure("Could not open database."); 237 getRequestCallback()->sendFailure("Could not open database.");
238 return; 238 return;
239 } 239 }
240 idbOpenDBRequest->addEventListener(EventTypeNames::upgradeneeded, upgradeCal lback, false); 240 idbOpenDBRequest->addEventListener(EventTypeNames::upgradeneeded, upgradeCal lback, false);
241 idbOpenDBRequest->addEventListener(EventTypeNames::success, openCallback, fa lse); 241 idbOpenDBRequest->addEventListener(EventTypeNames::success, openCallback, fa lse);
242 } 242 }
243 243
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 400
401 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed; 401 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed;
402 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed; 402 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed;
403 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp e); 403 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp e);
404 } 404 }
405 405
406 class DataLoader; 406 class DataLoader;
407 407
408 class OpenCursorCallback final : public EventListener { 408 class OpenCursorCallback final : public EventListener {
409 public: 409 public:
410 static PassRefPtrWillBeRawPtr<OpenCursorCallback> create(ScriptState* script State, PassOwnPtr<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize) 410 static RawPtr<OpenCursorCallback> create(ScriptState* scriptState, PassOwnPt r<RequestDataCallback> requestCallback, int skipCount, unsigned pageSize)
411 { 411 {
412 return adoptRefWillBeNoop(new OpenCursorCallback(scriptState, requestCal lback, skipCount, pageSize)); 412 return new OpenCursorCallback(scriptState, requestCallback, skipCount, p ageSize);
413 } 413 }
414 414
415 ~OpenCursorCallback() override { } 415 ~OpenCursorCallback() override { }
416 416
417 bool operator==(const EventListener& other) const override 417 bool operator==(const EventListener& other) const override
418 { 418 {
419 return this == &other; 419 return this == &other;
420 } 420 }
421 421
422 void handleEvent(ExecutionContext*, Event* event) override 422 void handleEvent(ExecutionContext*, Event* event) override
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 IDBIndex* idbIndex = indexForObjectStore(idbObjectStore, m_indexName ); 537 IDBIndex* idbIndex = indexForObjectStore(idbObjectStore, m_indexName );
538 if (!idbIndex) { 538 if (!idbIndex) {
539 m_requestCallback->sendFailure("Could not get index"); 539 m_requestCallback->sendFailure("Could not get index");
540 return; 540 return;
541 } 541 }
542 542
543 idbRequest = idbIndex->openCursor(getScriptState(), m_idbKeyRange.ge t(), WebIDBCursorDirectionNext); 543 idbRequest = idbIndex->openCursor(getScriptState(), m_idbKeyRange.ge t(), WebIDBCursorDirectionNext);
544 } else { 544 } else {
545 idbRequest = idbObjectStore->openCursor(getScriptState(), m_idbKeyRa nge.get(), WebIDBCursorDirectionNext); 545 idbRequest = idbObjectStore->openCursor(getScriptState(), m_idbKeyRa nge.get(), WebIDBCursorDirectionNext);
546 } 546 }
547 RefPtrWillBeRawPtr<OpenCursorCallback> openCursorCallback = OpenCursorCa llback::create(getScriptState(), m_requestCallback.release(), m_skipCount, m_pag eSize); 547 RawPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::crea te(getScriptState(), m_requestCallback.release(), m_skipCount, m_pageSize);
548 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback , false); 548 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback , false);
549 } 549 }
550 550
551 RequestCallback* getRequestCallback() override { return m_requestCallback.ge t(); } 551 RequestCallback* getRequestCallback() override { return m_requestCallback.ge t(); }
552 DataLoader(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> request Callback, const String& objectStoreName, const String& indexName, IDBKeyRange* i dbKeyRange, int skipCount, unsigned pageSize) 552 DataLoader(ScriptState* scriptState, PassOwnPtr<RequestDataCallback> request Callback, const String& objectStoreName, const String& indexName, IDBKeyRange* i dbKeyRange, int skipCount, unsigned pageSize)
553 : ExecutableWithDatabase(scriptState) 553 : ExecutableWithDatabase(scriptState)
554 , m_requestCallback(requestCallback) 554 , m_requestCallback(requestCallback)
555 , m_objectStoreName(objectStoreName) 555 , m_objectStoreName(objectStoreName)
556 , m_indexName(indexName) 556 , m_indexName(indexName)
557 , m_idbKeyRange(idbKeyRange) 557 , m_idbKeyRange(idbKeyRange)
558 , m_skipCount(skipCount) 558 , m_skipCount(skipCount)
559 , m_pageSize(pageSize) 559 , m_pageSize(pageSize)
560 { 560 {
561 } 561 }
562 562
563 OwnPtr<RequestDataCallback> m_requestCallback; 563 OwnPtr<RequestDataCallback> m_requestCallback;
564 String m_objectStoreName; 564 String m_objectStoreName;
565 String m_indexName; 565 String m_indexName;
566 Persistent<IDBKeyRange> m_idbKeyRange; 566 Persistent<IDBKeyRange> m_idbKeyRange;
567 int m_skipCount; 567 int m_skipCount;
568 unsigned m_pageSize; 568 unsigned m_pageSize;
569 }; 569 };
570 570
571 } // namespace 571 } // namespace
572 572
573 // static 573 // static
574 PassOwnPtrWillBeRawPtr<InspectorIndexedDBAgent> InspectorIndexedDBAgent::create( InspectedFrames* inspectedFrames) 574 RawPtr<InspectorIndexedDBAgent> InspectorIndexedDBAgent::create(InspectedFrames* inspectedFrames)
575 { 575 {
576 return adoptPtrWillBeNoop(new InspectorIndexedDBAgent(inspectedFrames)); 576 return new InspectorIndexedDBAgent(inspectedFrames);
577 } 577 }
578 578
579 InspectorIndexedDBAgent::InspectorIndexedDBAgent(InspectedFrames* inspectedFrame s) 579 InspectorIndexedDBAgent::InspectorIndexedDBAgent(InspectedFrames* inspectedFrame s)
580 : InspectorBaseAgent<InspectorIndexedDBAgent, protocol::Frontend::IndexedDB> ("IndexedDB") 580 : InspectorBaseAgent<InspectorIndexedDBAgent, protocol::Frontend::IndexedDB> ("IndexedDB")
581 , m_inspectedFrames(inspectedFrames) 581 , m_inspectedFrames(inspectedFrames)
582 { 582 {
583 } 583 }
584 584
585 InspectorIndexedDBAgent::~InspectorIndexedDBAgent() 585 InspectorIndexedDBAgent::~InspectorIndexedDBAgent()
586 { 586 {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 if (!scriptState) 698 if (!scriptState)
699 return; 699 return;
700 ScriptState::Scope scope(scriptState); 700 ScriptState::Scope scope(scriptState);
701 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); 701 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize);
702 dataLoader->start(idbFactory, document->getSecurityOrigin(), databaseName); 702 dataLoader->start(idbFactory, document->getSecurityOrigin(), databaseName);
703 } 703 }
704 704
705 class ClearObjectStoreListener final : public EventListener { 705 class ClearObjectStoreListener final : public EventListener {
706 WTF_MAKE_NONCOPYABLE(ClearObjectStoreListener); 706 WTF_MAKE_NONCOPYABLE(ClearObjectStoreListener);
707 public: 707 public:
708 static PassRefPtrWillBeRawPtr<ClearObjectStoreListener> create(PassOwnPtr<Cl earObjectStoreCallback> requestCallback) 708 static RawPtr<ClearObjectStoreListener> create(PassOwnPtr<ClearObjectStoreCa llback> requestCallback)
709 { 709 {
710 return adoptRefWillBeNoop(new ClearObjectStoreListener(requestCallback)) ; 710 return new ClearObjectStoreListener(requestCallback);
711 } 711 }
712 712
713 ~ClearObjectStoreListener() override { } 713 ~ClearObjectStoreListener() override { }
714 714
715 bool operator==(const EventListener& other) const override 715 bool operator==(const EventListener& other) const override
716 { 716 {
717 return this == &other; 717 return this == &other;
718 } 718 }
719 719
720 void handleEvent(ExecutionContext*, Event* event) override 720 void handleEvent(ExecutionContext*, Event* event) override
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN ame); 805 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN ame);
806 } 806 }
807 807
808 DEFINE_TRACE(InspectorIndexedDBAgent) 808 DEFINE_TRACE(InspectorIndexedDBAgent)
809 { 809 {
810 visitor->trace(m_inspectedFrames); 810 visitor->trace(m_inspectedFrames);
811 InspectorBaseAgent::trace(visitor); 811 InspectorBaseAgent::trace(visitor);
812 } 812 }
813 813
814 } // namespace blink 814 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698