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

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

Issue 1893203004: [DevTools] Fix leak in InspectorDatabaseAgent. (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
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 , m_enabled(false) 252 , m_enabled(false)
253 { 253 {
254 DatabaseClient::fromPage(page)->setInspectorAgent(this); 254 DatabaseClient::fromPage(page)->setInspectorAgent(this);
255 DatabaseTracker::tracker().forEachOpenDatabaseInPage(m_page, bind<blink::Dat abase*>(&InspectorDatabaseAgent::registerDatabaseOnCreation, this)); 255 DatabaseTracker::tracker().forEachOpenDatabaseInPage(m_page, bind<blink::Dat abase*>(&InspectorDatabaseAgent::registerDatabaseOnCreation, this));
256 } 256 }
257 257
258 InspectorDatabaseAgent::~InspectorDatabaseAgent() 258 InspectorDatabaseAgent::~InspectorDatabaseAgent()
259 { 259 {
260 } 260 }
261 261
262 void InspectorDatabaseAgent::discardAgent()
263 {
264 if (DatabaseClient* client = DatabaseClient::fromPage(m_page))
265 client->setInspectorAgent(nullptr);
266 }
267
262 void InspectorDatabaseAgent::enable(ErrorString*) 268 void InspectorDatabaseAgent::enable(ErrorString*)
263 { 269 {
264 if (m_enabled) 270 if (m_enabled)
265 return; 271 return;
266 m_enabled = true; 272 m_enabled = true;
267 m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled); 273 m_state->setBoolean(DatabaseAgentState::databaseAgentEnabled, m_enabled);
268 274
269 DatabaseResourcesHeapMap::iterator databasesEnd = m_resources.end(); 275 DatabaseResourcesHeapMap::iterator databasesEnd = m_resources.end();
270 for (DatabaseResourcesHeapMap::iterator it = m_resources.begin(); it != data basesEnd; ++it) 276 for (DatabaseResourcesHeapMap::iterator it = m_resources.begin(); it != data basesEnd; ++it)
271 it->value->bind(frontend()); 277 it->value->bind(frontend());
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 348 }
343 349
344 DEFINE_TRACE(InspectorDatabaseAgent) 350 DEFINE_TRACE(InspectorDatabaseAgent)
345 { 351 {
346 visitor->trace(m_page); 352 visitor->trace(m_page);
347 visitor->trace(m_resources); 353 visitor->trace(m_resources);
348 InspectorBaseAgent::trace(visitor); 354 InspectorBaseAgent::trace(visitor);
349 } 355 }
350 356
351 } // namespace blink 357 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webdatabase/InspectorDatabaseAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698