Commit 3970c423 authored by zelidrag@chromium.org's avatar zelidrag@chromium.org

Fixed remaining CL comments from review of http://codereview.chromium.org/9561009/

BUG=chromium-os:26961
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9580016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124742 0039d316-1c4b-4281-b951-d872f2087c98
parent cb01852b
...@@ -472,6 +472,10 @@ void GDataFileSystem::CreateDirectoryInternal( ...@@ -472,6 +472,10 @@ void GDataFileSystem::CreateDirectoryInternal(
// this function. // this function.
break; break;
} }
default: {
NOTREACHED();
break;
}
} }
// Do we have a parent directory here as well? We can't then create target // Do we have a parent directory here as well? We can't then create target
...@@ -588,10 +592,11 @@ void GDataFileSystem::OnCreateDirectoryCompleted( ...@@ -588,10 +592,11 @@ void GDataFileSystem::OnCreateDirectoryCompleted(
// Not done yet with recursive directory creation? // Not done yet with recursive directory creation?
if (params.target_directory_path != params.created_directory_path && if (params.target_directory_path != params.created_directory_path &&
params.is_recursive) { params.is_recursive) {
CreateDirectory(params.target_directory_path, CreateDirectoryInternal(params.target_directory_path,
params.is_exclusive, params.is_exclusive,
params.is_recursive, params.is_recursive,
params.callback); params.callback,
params.proxy);
return; return;
} }
...@@ -755,7 +760,6 @@ base::PlatformFileError GDataFileSystem::UpdateDirectoryWithDocumentFeed( ...@@ -755,7 +760,6 @@ base::PlatformFileError GDataFileSystem::UpdateDirectoryWithDocumentFeed(
return base::PLATFORM_FILE_OK; return base::PLATFORM_FILE_OK;
} }
base::PlatformFileError GDataFileSystem::AddNewDirectory( base::PlatformFileError GDataFileSystem::AddNewDirectory(
const FilePath& directory_path, base::Value* entry_value) { const FilePath& directory_path, base::Value* entry_value) {
if (!entry_value) if (!entry_value)
...@@ -779,6 +783,9 @@ base::PlatformFileError GDataFileSystem::AddNewDirectory( ...@@ -779,6 +783,9 @@ base::PlatformFileError GDataFileSystem::AddNewDirectory(
if (!file) if (!file)
return base::PLATFORM_FILE_ERROR_FAILED; return base::PLATFORM_FILE_ERROR_FAILED;
// Check if parent is a directory since in theory since this is a callback
// something could in the meantime have nuked the parent dir and created a
// file with the exact same name.
GDataDirectory* parent_dir = file->AsGDataDirectory(); GDataDirectory* parent_dir = file->AsGDataDirectory();
if (!parent_dir) if (!parent_dir)
return base::PLATFORM_FILE_ERROR_FAILED; return base::PLATFORM_FILE_ERROR_FAILED;
......
...@@ -305,7 +305,7 @@ class GDataFileSystem : public ProfileKeyedService { ...@@ -305,7 +305,7 @@ class GDataFileSystem : public ProfileKeyedService {
FOUND_INVALID, FOUND_INVALID,
// Found missing directory segment while searching for given directory. // Found missing directory segment while searching for given directory.
FOUND_MISSING, FOUND_MISSING,
// Found target directory, it's already exists. // Found target directory, it already exists.
DIRECTORY_ALREADY_PRESENT, DIRECTORY_ALREADY_PRESENT,
}; };
......
...@@ -50,10 +50,7 @@ class FindFileDelegateReplyBase : public FindFileDelegate { ...@@ -50,10 +50,7 @@ class FindFileDelegateReplyBase : public FindFileDelegate {
: file_system_(file_system), : file_system_(file_system),
search_file_path_(search_file_path), search_file_path_(search_file_path),
require_content_(require_content) { require_content_(require_content) {
BrowserThread::ID thread_id; reply_message_proxy_ = MessageLoopProxy::current();
CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
replay_message_proxy_ =
BrowserThread::GetMessageLoopProxyForThread(thread_id);
} }
virtual ~FindFileDelegateReplyBase() {} virtual ~FindFileDelegateReplyBase() {}
...@@ -98,7 +95,7 @@ class FindFileDelegateReplyBase : public FindFileDelegate { ...@@ -98,7 +95,7 @@ class FindFileDelegateReplyBase : public FindFileDelegate {
FilePath search_file_path_; FilePath search_file_path_;
// True if the final directory content is required. // True if the final directory content is required.
bool require_content_; bool require_content_;
scoped_refptr<MessageLoopProxy> replay_message_proxy_; scoped_refptr<MessageLoopProxy> reply_message_proxy_;
}; };
// GetFileInfoDelegate is used to handle results of proxy's content search // GetFileInfoDelegate is used to handle results of proxy's content search
...@@ -138,7 +135,7 @@ class GetFileInfoDelegate : public FindFileDelegateReplyBase { ...@@ -138,7 +135,7 @@ class GetFileInfoDelegate : public FindFileDelegateReplyBase {
const base::PlatformFileInfo& file_info, const base::PlatformFileInfo& file_info,
const FilePath& platform_path) { const FilePath& platform_path) {
if (!callback_.is_null()) { if (!callback_.is_null()) {
replay_message_proxy_->PostTask(FROM_HERE, reply_message_proxy_->PostTask(FROM_HERE,
Bind(&GetFileInfoDelegate::ReplyOnCallingThread, Bind(&GetFileInfoDelegate::ReplyOnCallingThread,
this, this,
result, result,
...@@ -218,7 +215,7 @@ class ReadDirectoryDelegate : public FindFileDelegateReplyBase { ...@@ -218,7 +215,7 @@ class ReadDirectoryDelegate : public FindFileDelegateReplyBase {
const std::vector<base::FileUtilProxy::Entry>& file_list, const std::vector<base::FileUtilProxy::Entry>& file_list,
bool has_more) { bool has_more) {
if (!callback_.is_null()) { if (!callback_.is_null()) {
replay_message_proxy_->PostTask(FROM_HERE, reply_message_proxy_->PostTask(FROM_HERE,
Bind(&ReadDirectoryDelegate::ReplyOnCallingThread, Bind(&ReadDirectoryDelegate::ReplyOnCallingThread,
this, this,
result, result,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment