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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 8888026: Fix leak in testing_automation_provider.cc by postponing creating a dictionary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 6282 matching lines...) Expand 10 before | Expand all | Expand 10 after
6293 view_list->Append(dict); 6293 view_list->Append(dict);
6294 } 6294 }
6295 } 6295 }
6296 6296
6297 ExtensionProcessManager* extension_mgr = 6297 ExtensionProcessManager* extension_mgr =
6298 profile()->GetExtensionProcessManager(); 6298 profile()->GetExtensionProcessManager();
6299 ExtensionProcessManager::const_iterator iter; 6299 ExtensionProcessManager::const_iterator iter;
6300 for (iter = extension_mgr->begin(); iter != extension_mgr->end(); 6300 for (iter = extension_mgr->begin(); iter != extension_mgr->end();
6301 ++iter) { 6301 ++iter) {
6302 ExtensionHost* host = *iter; 6302 ExtensionHost* host = *iter;
6303 DictionaryValue* dict = new DictionaryValue();
6304 AutomationId id = automation_util::GetIdForExtensionView(host); 6303 AutomationId id = automation_util::GetIdForExtensionView(host);
6305 if (!id.is_valid()) 6304 if (!id.is_valid())
6306 continue; 6305 continue;
6306 DictionaryValue* dict = new DictionaryValue();
6307 dict->Set("auto_id", id.ToValue()); 6307 dict->Set("auto_id", id.ToValue());
6308 dict->SetString("extension_id", host->extension_id()); 6308 dict->SetString("extension_id", host->extension_id());
6309 view_list->Append(dict); 6309 view_list->Append(dict);
6310 } 6310 }
6311 DictionaryValue dict; 6311 DictionaryValue dict;
6312 dict.Set("views", view_list); 6312 dict.Set("views", view_list);
6313 AutomationJSONReply(this, reply_message).SendSuccess(&dict); 6313 AutomationJSONReply(this, reply_message).SendSuccess(&dict);
6314 } 6314 }
6315 6315
6316 void TestingAutomationProvider::IsTabIdValid( 6316 void TestingAutomationProvider::IsTabIdValid(
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
6646 6646
6647 Send(reply_message_); 6647 Send(reply_message_);
6648 redirect_query_ = 0; 6648 redirect_query_ = 0;
6649 reply_message_ = NULL; 6649 reply_message_ = NULL;
6650 } 6650 }
6651 6651
6652 void TestingAutomationProvider::OnRemoveProvider() { 6652 void TestingAutomationProvider::OnRemoveProvider() {
6653 if (g_browser_process) 6653 if (g_browser_process)
6654 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6654 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6655 } 6655 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698