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

Side by Side Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 7294013: Modified cancel and interrupt processing to avoid race with history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 AutomationProviderDownloadItemObserver:: 1454 AutomationProviderDownloadItemObserver::
1455 ~AutomationProviderDownloadItemObserver() {} 1455 ~AutomationProviderDownloadItemObserver() {}
1456 1456
1457 void AutomationProviderDownloadItemObserver::OnDownloadUpdated( 1457 void AutomationProviderDownloadItemObserver::OnDownloadUpdated(
1458 DownloadItem* download) { 1458 DownloadItem* download) {
1459 interrupted_ |= download->IsInterrupted(); 1459 interrupted_ |= download->IsInterrupted();
1460 // If any download was interrupted, on the next update each outstanding 1460 // If any download was interrupted, on the next update each outstanding
1461 // download is cancelled. 1461 // download is cancelled.
1462 if (interrupted_) { 1462 if (interrupted_) {
1463 // |Cancel()| does nothing if |download| is already interrupted. 1463 // |Cancel()| does nothing if |download| is already interrupted.
1464 download->Cancel(true); 1464 download->Cancel();
1465 RemoveAndCleanupOnLastEntry(download); 1465 RemoveAndCleanupOnLastEntry(download);
1466 } 1466 }
1467 1467
1468 if (download->IsComplete()) 1468 if (download->IsComplete())
1469 RemoveAndCleanupOnLastEntry(download); 1469 RemoveAndCleanupOnLastEntry(download);
1470 } 1470 }
1471 1471
1472 // We don't want to send multiple messages, as the behavior is undefined. 1472 // We don't want to send multiple messages, as the behavior is undefined.
1473 // Set |interrupted_| on error, and on the last download completed/ 1473 // Set |interrupted_| on error, and on the last download completed/
1474 // interrupted, send either an error or a success message. 1474 // interrupted, send either an error or a success message.
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 this, 2562 this,
2563 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); 2563 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread));
2564 } 2564 }
2565 2565
2566 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { 2566 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() {
2567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 2567 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
2568 if (automation_) 2568 if (automation_)
2569 automation_->Send(reply_message_.release()); 2569 automation_->Send(reply_message_.release());
2570 Release(); 2570 Release();
2571 } 2571 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698