OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_to_mobile_service.h" | 5 #include "chrome/browser/chrome_to_mobile_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 base::WeakPtr<Observer> observer; | 740 base::WeakPtr<Observer> observer; |
741 RequestObserverMap::iterator i = request_observer_map_.find(source); | 741 RequestObserverMap::iterator i = request_observer_map_.find(source); |
742 if (i != request_observer_map_.end()) { | 742 if (i != request_observer_map_.end()) { |
743 observer = i->second; | 743 observer = i->second; |
744 request_observer_map_.erase(i); | 744 request_observer_map_.erase(i); |
745 } | 745 } |
746 | 746 |
747 // Check if the observer is waiting on a second response (url or snapshot). | 747 // Check if the observer is waiting on a second response (url or snapshot). |
748 for (RequestObserverMap::iterator other = request_observer_map_.begin(); | 748 for (RequestObserverMap::iterator other = request_observer_map_.begin(); |
749 observer.get() && (other != request_observer_map_.end()); ++other) { | 749 observer.get() && (other != request_observer_map_.end()); ++other) { |
750 if (other->second == observer) { | 750 if (other->second.get() == observer.get()) { |
751 // Delay reporting success until the second response is received. | 751 // Delay reporting success until the second response is received. |
752 if (success) | 752 if (success) |
753 return; | 753 return; |
754 | 754 |
755 // Report failure below and ignore the second response. | 755 // Report failure below and ignore the second response. |
756 request_observer_map_.erase(other); | 756 request_observer_map_.erase(other); |
757 break; | 757 break; |
758 } | 758 } |
759 } | 759 } |
760 | 760 |
761 if (observer.get()) | 761 if (observer.get()) |
762 observer->OnSendComplete(success); | 762 observer->OnSendComplete(success); |
763 } | 763 } |
OLD | NEW |