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

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

Issue 1880273002: [DevTools] Create last agents on attach, modify InspectorDatabaseAgent to support it. (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) 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 11 matching lines...) Expand all
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #include "modules/webdatabase/InspectorDatabaseAgent.h" 29 #include "modules/webdatabase/InspectorDatabaseAgent.h"
30 30
31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
32 #include "core/dom/Document.h"
32 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
33 #include "core/html/VoidCallback.h" 34 #include "core/html/VoidCallback.h"
34 #include "core/loader/DocumentLoader.h" 35 #include "core/loader/DocumentLoader.h"
35 #include "core/page/Page.h" 36 #include "core/page/Page.h"
36 #include "modules/webdatabase/Database.h" 37 #include "modules/webdatabase/Database.h"
37 #include "modules/webdatabase/DatabaseClient.h" 38 #include "modules/webdatabase/DatabaseClient.h"
39 #include "modules/webdatabase/DatabaseTracker.h"
38 #include "modules/webdatabase/InspectorDatabaseResource.h" 40 #include "modules/webdatabase/InspectorDatabaseResource.h"
39 #include "modules/webdatabase/SQLError.h" 41 #include "modules/webdatabase/SQLError.h"
40 #include "modules/webdatabase/SQLResultSet.h" 42 #include "modules/webdatabase/SQLResultSet.h"
41 #include "modules/webdatabase/SQLResultSetRowList.h" 43 #include "modules/webdatabase/SQLResultSetRowList.h"
42 #include "modules/webdatabase/SQLStatementCallback.h" 44 #include "modules/webdatabase/SQLStatementCallback.h"
43 #include "modules/webdatabase/SQLStatementErrorCallback.h" 45 #include "modules/webdatabase/SQLStatementErrorCallback.h"
44 #include "modules/webdatabase/SQLTransaction.h" 46 #include "modules/webdatabase/SQLTransaction.h"
45 #include "modules/webdatabase/SQLTransactionCallback.h" 47 #include "modules/webdatabase/SQLTransactionCallback.h"
46 #include "modules/webdatabase/SQLTransactionErrorCallback.h" 48 #include "modules/webdatabase/SQLTransactionErrorCallback.h"
47 #include "modules/webdatabase/sqlite/SQLValue.h" 49 #include "modules/webdatabase/sqlite/SQLValue.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void handleEvent() override { } 214 void handleEvent() override { }
213 215
214 private: 216 private:
215 TransactionSuccessCallback() { } 217 TransactionSuccessCallback() { }
216 }; 218 };
217 219
218 } // namespace 220 } // namespace
219 221
220 void InspectorDatabaseAgent::didOpenDatabase(blink::Database* database, const St ring& domain, const String& name, const String& version) 222 void InspectorDatabaseAgent::didOpenDatabase(blink::Database* database, const St ring& domain, const String& name, const String& version)
221 { 223 {
224 ExecutionContext* context = database->getExecutionContext();
225 if (!context->isDocument())
michaeln 2016/04/13 22:18:18 you could ASSERT(isDocument()) since websql is no
226 return;
227 if (toDocument(context)->frame()->page() != m_page)
michaeln 2016/04/13 22:18:18 oh, you filter for this page only
228 return;
229
222 if (InspectorDatabaseResource* resource = findByFileName(database->fileName( ))) { 230 if (InspectorDatabaseResource* resource = findByFileName(database->fileName( ))) {
223 resource->setDatabase(database); 231 resource->setDatabase(database);
224 return; 232 return;
225 } 233 }
226 234
227 InspectorDatabaseResource* resource = InspectorDatabaseResource::create(data base, domain, name, version); 235 InspectorDatabaseResource* resource = InspectorDatabaseResource::create(data base, domain, name, version);
228 m_resources.set(resource->id(), resource); 236 m_resources.set(resource->id(), resource);
229 // Resources are only bound while visible. 237 // Resources are only bound while visible.
230 if (frontend() && m_enabled) 238 if (frontend() && m_enabled)
231 resource->bind(frontend()); 239 resource->bind(frontend());
232 } 240 }
233 241
234 void InspectorDatabaseAgent::didCommitLoadForLocalFrame(LocalFrame* frame) 242 void InspectorDatabaseAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
235 { 243 {
236 // FIXME(dgozman): adapt this for out-of-process iframes. 244 // FIXME(dgozman): adapt this for out-of-process iframes.
237 if (frame != m_page->mainFrame()) 245 if (frame != m_page->mainFrame())
238 return; 246 return;
239 247
240 m_resources.clear(); 248 m_resources.clear();
241 } 249 }
242 250
243 InspectorDatabaseAgent::InspectorDatabaseAgent(Page* page) 251 InspectorDatabaseAgent::InspectorDatabaseAgent(Page* page)
244 : InspectorBaseAgent<InspectorDatabaseAgent, protocol::Frontend::Database>(" Database") 252 : InspectorBaseAgent<InspectorDatabaseAgent, protocol::Frontend::Database>(" Database")
245 , m_page(page) 253 , m_page(page)
246 , m_enabled(false) 254 , m_enabled(false)
247 { 255 {
248 DatabaseClient::fromPage(page)->setInspectorAgent(this); 256 DatabaseClient::fromPage(page)->setInspectorAgent(this);
257 DatabaseTracker::tracker().registerAllDatabasesInInspector(this);
michaeln 2016/04/13 22:18:18 From the looks of the didCommitLoadForLocalFrame()
dgozman 2016/04/13 22:26:04 That's why I've added filtering to didOpenDatabase
249 } 258 }
250 259
251 InspectorDatabaseAgent::~InspectorDatabaseAgent() 260 InspectorDatabaseAgent::~InspectorDatabaseAgent()
252 { 261 {
253 } 262 }
254 263
255 void InspectorDatabaseAgent::enable(ErrorString*) 264 void InspectorDatabaseAgent::enable(ErrorString*)
256 { 265 {
257 if (m_enabled) 266 if (m_enabled)
258 return; 267 return;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 344 }
336 345
337 DEFINE_TRACE(InspectorDatabaseAgent) 346 DEFINE_TRACE(InspectorDatabaseAgent)
338 { 347 {
339 visitor->trace(m_page); 348 visitor->trace(m_page);
340 visitor->trace(m_resources); 349 visitor->trace(m_resources);
341 InspectorBaseAgent::trace(visitor); 350 InspectorBaseAgent::trace(visitor);
342 } 351 }
343 352
344 } // namespace blink 353 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698