Skip to content

Commit

Permalink
Revert 213341 "Clean up TranslateManager's URL fetchers so that ..."
Browse files Browse the repository at this point in the history
> Clean up TranslateManager's URL fetchers so that they are destroyed in the correct thread.
> 
> BUG=263240
> TEST=browser_tests
> 
> Review URL: https://chromiumcodereview.appspot.com/19555005

TBR=hajimehoshi@chromium.org

Review URL: https://codereview.chromium.org/19804012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213486 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dgrogan@chromium.org committed Jul 24, 2013
1 parent 4a29a11 commit 73b0567
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
7 changes: 4 additions & 3 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1690,10 +1690,11 @@ void ChromeBrowserMainParts::PostMainMessageLoopRun() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();

// TranslateManager's URL fetchers should be destructed in the main thread
// Some tests don't set parameters.ui_task, so they started translate
// language fetch that was never completed so we need to cleanup here
// otherwise it will be done by the destructor in a wrong thread.
if (translate_manager_ != NULL)
translate_manager_->CleanupPendingUrlFetcher();
if (parameters().ui_task == NULL && translate_manager_ != NULL)
translate_manager_->CleanupPendingUlrFetcher();

if (notify_result_ == ProcessSingleton::PROCESS_NONE)
process_singleton_->Cleanup();
Expand Down
6 changes: 1 addition & 5 deletions chrome/browser/translate/translate_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ const int kMaxTranslateLoadCheckAttempts = 20;
} // namespace

TranslateManager::~TranslateManager() {
// CleanupPendingUrlFetcher should be called ahead of destructing.
DCHECK(language_list_.get() == NULL);
DCHECK(script_.get() == NULL);

weak_method_factory_.InvalidateWeakPtrs();
}

Expand Down Expand Up @@ -638,7 +634,7 @@ void TranslateManager::FetchLanguageListFromTranslateServer(
NOTREACHED();
}

void TranslateManager::CleanupPendingUrlFetcher() {
void TranslateManager::CleanupPendingUlrFetcher() {
language_list_.reset();
script_.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/translate/translate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TranslateManager : public content::NotificationObserver {

// Allows caller to cleanup pending URLFetcher objects to make sure they
// get released in the appropriate thread... Mainly for tests.
void CleanupPendingUrlFetcher();
void CleanupPendingUlrFetcher();

// Translates the page contents from |source_lang| to |target_lang|.
// The actual translation might be performed asynchronously if the translate
Expand Down

0 comments on commit 73b0567

Please sign in to comment.