Clean up code

This commit is contained in:
Cheng Zhao 2015-06-09 09:51:38 +08:00
parent a56c132835
commit b2eb23aa01

View file

@ -15,18 +15,17 @@
namespace { namespace {
base::Value* GetConstants() { scoped_ptr<base::DictionaryValue> GetConstants() {
scoped_ptr<base::DictionaryValue> constants = net::GetNetConstants(); scoped_ptr<base::DictionaryValue> constants = net::GetNetConstants();
// Adding client information to constants dictionary. // Adding client information to constants dictionary.
base::DictionaryValue* client_info = new base::DictionaryValue(); base::DictionaryValue* client_info = new base::DictionaryValue();
client_info->SetString(
client_info->SetString("command_line", "command_line",
base::CommandLine::ForCurrentProcess()->GetCommandLineString()); base::CommandLine::ForCurrentProcess()->GetCommandLineString());
constants->Set("clientInfo", client_info); constants->Set("clientInfo", client_info);
return constants;
return constants.release();
} }
} // namespace } // namespace
@ -51,7 +50,7 @@ NetLog::NetLog(net::URLRequestContext* context)
<< "for net logging"; << "for net logging";
} else { } else {
std::string json; std::string json;
scoped_ptr<base::Value> constants(GetConstants()); scoped_ptr<base::Value> constants(GetConstants().Pass());
base::JSONWriter::Write(constants.get(), &json); base::JSONWriter::Write(constants.get(), &json);
fprintf(log_file_.get(), "{\"constants\": %s, \n", json.c_str()); fprintf(log_file_.get(), "{\"constants\": %s, \n", json.c_str());
fprintf(log_file_.get(), "\"events\": [\n"); fprintf(log_file_.get(), "\"events\": [\n");