Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_files.cc |
| diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc |
| index efe657cccce69da6faed8da9201f66bb60581d7c..e188d11af343ff25989391b8857fe6840f68d8ae 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_files.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_files.cc |
| @@ -734,20 +734,20 @@ scoped_ptr<GDataEntry> GDataEntry::FromProtoString( |
| GDataDirectoryProto dir_proto; |
| bool ok = dir_proto.ParseFromString(serialized_proto); |
| if (ok && dir_proto.gdata_entry().file_info().is_directory()) { |
| - GDataDirectory* dir = new GDataDirectory(NULL, NULL); |
| + scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL, NULL)); |
| if (!dir->FromProto(dir_proto)) |
| return scoped_ptr<GDataEntry>(NULL); |
| - return scoped_ptr<GDataEntry>(dir); |
| + return scoped_ptr<GDataEntry>(dir.release()); |
|
achuithb
2012/07/10 23:09:02
I think you can return dir.Pass() in both cases, i
satorux1
2012/07/10 23:25:04
If FromProto() failed, we should return NULL.
Not
achuithb
2012/07/10 23:29:15
Ah, that's unfortunate. I believe there's a way to
|
| } |
| GDataFileProto file_proto; |
| ok = file_proto.ParseFromString(serialized_proto); |
| if (ok) { |
| DCHECK(!file_proto.gdata_entry().file_info().is_directory()); |
| - GDataFile* file = new GDataFile(NULL, NULL); |
| + scoped_ptr<GDataFile> file(new GDataFile(NULL, NULL)); |
| if (!file->FromProto(file_proto)) |
| return scoped_ptr<GDataEntry>(NULL); |
| - return scoped_ptr<GDataEntry>(file); |
| + return scoped_ptr<GDataEntry>(file.release()); |
|
achuithb
2012/07/10 23:09:02
same
|
| } |
| return scoped_ptr<GDataEntry>(NULL); |
| } |