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

Unified Diff: chrome/renderer/automation/dom_automation_controller.cc

Issue 20009: Fix memory leak. (Closed)
Patch Set: Change to scoped_ptr. Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/automation/dom_automation_controller.cc
diff --git a/chrome/renderer/automation/dom_automation_controller.cc b/chrome/renderer/automation/dom_automation_controller.cc
index ba06b28121e320582b23edcacd27f832cc2f8ed6..56aea6e4000e1da7776014a0d31ad75fd074495c 100644
--- a/chrome/renderer/automation/dom_automation_controller.cc
+++ b/chrome/renderer/automation/dom_automation_controller.cc
@@ -31,7 +31,7 @@ void DomAutomationController::send(const CppArgumentList& args,
std::string json;
JSONStringValueSerializer serializer(&json);
- Value* value = NULL;
+ scoped_ptr<Value> value;
// Warning: note that JSON officially requires the root-level object to be
// an object (e.g. {foo:3}) or an array, while here we're serializing
@@ -41,15 +41,15 @@ void DomAutomationController::send(const CppArgumentList& args,
// grabbing the 0th element to get the value out.
switch(args[0].type) {
case NPVariantType_String: {
- value = Value::CreateStringValue(args[0].ToString());
+ value.reset(Value::CreateStringValue(args[0].ToString()));
break;
}
case NPVariantType_Bool: {
- value = Value::CreateBooleanValue(args[0].ToBoolean());
+ value.reset(Value::CreateBooleanValue(args[0].ToBoolean()));
break;
}
case NPVariantType_Int32: {
- value = Value::CreateIntegerValue(args[0].ToInt32());
+ value.reset(Value::CreateIntegerValue(args[0].ToInt32()));
break;
}
case NPVariantType_Double: {
@@ -57,7 +57,7 @@ void DomAutomationController::send(const CppArgumentList& args,
// as a double in this binding. The reason being that KJS treats
// any number value as a double. Refer for more details,
// chrome/third_party/webkit/src/JavaScriptCore/bindings/c/c_utility.cpp
- value = Value::CreateIntegerValue(args[0].ToInt32());
+ value.reset(Value::CreateIntegerValue(args[0].ToInt32()));
break;
}
default: {
« 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