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

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: two databases in the test 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 17 matching lines...) Expand all
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/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/html/VoidCallback.h" 33 #include "core/html/VoidCallback.h"
34 #include "core/loader/DocumentLoader.h" 34 #include "core/loader/DocumentLoader.h"
35 #include "core/page/Page.h" 35 #include "core/page/Page.h"
36 #include "modules/webdatabase/Database.h" 36 #include "modules/webdatabase/Database.h"
37 #include "modules/webdatabase/DatabaseClient.h" 37 #include "modules/webdatabase/DatabaseClient.h"
38 #include "modules/webdatabase/DatabaseTracker.h"
38 #include "modules/webdatabase/InspectorDatabaseResource.h" 39 #include "modules/webdatabase/InspectorDatabaseResource.h"
39 #include "modules/webdatabase/SQLError.h" 40 #include "modules/webdatabase/SQLError.h"
40 #include "modules/webdatabase/SQLResultSet.h" 41 #include "modules/webdatabase/SQLResultSet.h"
41 #include "modules/webdatabase/SQLResultSetRowList.h" 42 #include "modules/webdatabase/SQLResultSetRowList.h"
42 #include "modules/webdatabase/SQLStatementCallback.h" 43 #include "modules/webdatabase/SQLStatementCallback.h"
43 #include "modules/webdatabase/SQLStatementErrorCallback.h" 44 #include "modules/webdatabase/SQLStatementErrorCallback.h"
44 #include "modules/webdatabase/SQLTransaction.h" 45 #include "modules/webdatabase/SQLTransaction.h"
45 #include "modules/webdatabase/SQLTransactionCallback.h" 46 #include "modules/webdatabase/SQLTransactionCallback.h"
46 #include "modules/webdatabase/SQLTransactionErrorCallback.h" 47 #include "modules/webdatabase/SQLTransactionErrorCallback.h"
47 #include "modules/webdatabase/sqlite/SQLValue.h" 48 #include "modules/webdatabase/sqlite/SQLValue.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 ~TransactionSuccessCallback() override { } 211 ~TransactionSuccessCallback() override { }
211 212
212 void handleEvent() override { } 213 void handleEvent() override { }
213 214
214 private: 215 private:
215 TransactionSuccessCallback() { } 216 TransactionSuccessCallback() { }
216 }; 217 };
217 218
218 } // namespace 219 } // namespace
219 220
221 void InspectorDatabaseAgent::registerDatabaseOnCreation(blink::Database* databas e)
222 {
223 didOpenDatabase(database, database->getSecurityOrigin()->host(), database->s tringIdentifier(), database->version());
224 }
225
220 void InspectorDatabaseAgent::didOpenDatabase(blink::Database* database, const St ring& domain, const String& name, const String& version) 226 void InspectorDatabaseAgent::didOpenDatabase(blink::Database* database, const St ring& domain, const String& name, const String& version)
221 { 227 {
222 if (InspectorDatabaseResource* resource = findByFileName(database->fileName( ))) { 228 if (InspectorDatabaseResource* resource = findByFileName(database->fileName( ))) {
223 resource->setDatabase(database); 229 resource->setDatabase(database);
224 return; 230 return;
225 } 231 }
226 232
227 InspectorDatabaseResource* resource = InspectorDatabaseResource::create(data base, domain, name, version); 233 InspectorDatabaseResource* resource = InspectorDatabaseResource::create(data base, domain, name, version);
228 m_resources.set(resource->id(), resource); 234 m_resources.set(resource->id(), resource);
229 // Resources are only bound while visible. 235 // Resources are only bound while visible.
230 if (frontend() && m_enabled) 236 if (frontend() && m_enabled)
231 resource->bind(frontend()); 237 resource->bind(frontend());
232 } 238 }
233 239
234 void InspectorDatabaseAgent::didCommitLoadForLocalFrame(LocalFrame* frame) 240 void InspectorDatabaseAgent::didCommitLoadForLocalFrame(LocalFrame* frame)
235 { 241 {
236 // FIXME(dgozman): adapt this for out-of-process iframes. 242 // FIXME(dgozman): adapt this for out-of-process iframes.
237 if (frame != m_page->mainFrame()) 243 if (frame != m_page->mainFrame())
238 return; 244 return;
239 245
240 m_resources.clear(); 246 m_resources.clear();
241 } 247 }
242 248
243 InspectorDatabaseAgent::InspectorDatabaseAgent(Page* page) 249 InspectorDatabaseAgent::InspectorDatabaseAgent(Page* page)
244 : InspectorBaseAgent<InspectorDatabaseAgent, protocol::Frontend::Database>(" Database") 250 : InspectorBaseAgent<InspectorDatabaseAgent, protocol::Frontend::Database>(" Database")
245 , m_page(page) 251 , m_page(page)
246 , m_enabled(false) 252 , m_enabled(false)
247 { 253 {
248 DatabaseClient::fromPage(page)->setInspectorAgent(this); 254 DatabaseClient::fromPage(page)->setInspectorAgent(this);
255 DatabaseTracker::tracker().forEachOpenDatabaseInPage(m_page, bind<blink::Dat abase*>(&InspectorDatabaseAgent::registerDatabaseOnCreation, this));
249 } 256 }
250 257
251 InspectorDatabaseAgent::~InspectorDatabaseAgent() 258 InspectorDatabaseAgent::~InspectorDatabaseAgent()
252 { 259 {
253 } 260 }
254 261
255 void InspectorDatabaseAgent::enable(ErrorString*) 262 void InspectorDatabaseAgent::enable(ErrorString*)
256 { 263 {
257 if (m_enabled) 264 if (m_enabled)
258 return; 265 return;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 342 }
336 343
337 DEFINE_TRACE(InspectorDatabaseAgent) 344 DEFINE_TRACE(InspectorDatabaseAgent)
338 { 345 {
339 visitor->trace(m_page); 346 visitor->trace(m_page);
340 visitor->trace(m_resources); 347 visitor->trace(m_resources);
341 InspectorBaseAgent::trace(visitor); 348 InspectorBaseAgent::trace(visitor);
342 } 349 }
343 350
344 } // namespace blink 351 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698