Index: chrome/browser/process_singleton_startup_lock.cc |
diff --git a/chrome/browser/process_singleton_startup_lock.cc b/chrome/browser/process_singleton_startup_lock.cc |
index cd3c0f7045dff4c64997a4b1b47c9f0b8290df02..cd75e3b15de4a773e939c14d248b24327e5fe9bf 100644 |
--- a/chrome/browser/process_singleton_startup_lock.cc |
+++ b/chrome/browser/process_singleton_startup_lock.cc |
@@ -6,13 +6,21 @@ |
#include "base/bind.h" |
#include "base/logging.h" |
+#include "chrome/browser/operation_output.h" |
ProcessSingletonStartupLock::ProcessSingletonStartupLock( |
- const ProcessSingleton::NotificationCallback& original_callback) |
+ const OperationCallback& operation_callback) |
: locked_(true), |
- original_callback_(original_callback) {} |
+ operation_callback_(operation_callback) {} |
-ProcessSingletonStartupLock::~ProcessSingletonStartupLock() {} |
+ProcessSingletonStartupLock::~ProcessSingletonStartupLock() { |
+ for (std::vector<DelayedStartupMessage>::const_iterator it = |
+ saved_startup_messages_.begin(); |
+ it != saved_startup_messages_.end(); ++it) { |
+ if (it->operation_output_) |
+ delete it->operation_output_; |
+ } |
+} |
ProcessSingleton::NotificationCallback |
ProcessSingletonStartupLock::AsNotificationCallback() { |
@@ -26,14 +34,20 @@ void ProcessSingletonStartupLock::Unlock() { |
// Replay the command lines of the messages which were received while the |
// ProcessSingleton was locked. Only replay each message once. |
- std::set<DelayedStartupMessage> replayed_messages; |
+ std::set<std::pair<CommandLine::StringVector, |
+ base::FilePath> > replayed_messages; |
for (std::vector<DelayedStartupMessage>::const_iterator it = |
saved_startup_messages_.begin(); |
it != saved_startup_messages_.end(); ++it) { |
- if (replayed_messages.find(*it) != replayed_messages.end()) |
+ scoped_ptr<OperationOutput> operation_output(it->operation_output_); |
+ std::pair<CommandLine::StringVector, base::FilePath> pair( |
+ it->argv_, it->current_directory_); |
+ if (replayed_messages.find(pair) != replayed_messages.end()) |
continue; |
- original_callback_.Run(CommandLine(it->first), it->second); |
- replayed_messages.insert(*it); |
+ operation_callback_.Run(CommandLine(it->argv_), |
+ it->current_directory_, |
+ operation_output.Pass()); |
+ replayed_messages.insert(pair); |
} |
saved_startup_messages_.clear(); |
} |
@@ -41,13 +55,30 @@ void ProcessSingletonStartupLock::Unlock() { |
bool ProcessSingletonStartupLock::NotificationCallbackImpl( |
const CommandLine& command_line, |
const base::FilePath& current_directory) { |
+ scoped_ptr<OperationOutput> operation_output = |
+ OperationOutput::Create(command_line); |
if (locked_) { |
// If locked, it means we are not ready to process this message because |
// we are probably in a first run critical phase. |
saved_startup_messages_.push_back( |
- std::make_pair(command_line.argv(), current_directory)); |
+ DelayedStartupMessage(command_line.argv(), |
+ current_directory, |
+ operation_output.release())); |
return true; |
} else { |
- return original_callback_.Run(command_line, current_directory); |
+ return operation_callback_.Run(command_line, |
+ current_directory, |
+ operation_output.Pass()); |
} |
} |
+ |
+ProcessSingletonStartupLock::DelayedStartupMessage::DelayedStartupMessage( |
+ const CommandLine::StringVector& argv, |
+ const base::FilePath& current_directory, |
+ OperationOutput* operation_output) |
+ : argv_(argv), |
+ current_directory_(current_directory), |
+ operation_output_(operation_output) { |
+} |
+ |
+ProcessSingletonStartupLock::DelayedStartupMessage::~DelayedStartupMessage() {} |