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 "content/browser/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.h" |
6 | 6 |
7 #include <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void set_terminate_child_on_shutdown(bool terminate_on_shutdown) { | 91 void set_terminate_child_on_shutdown(bool terminate_on_shutdown) { |
92 terminate_child_on_shutdown_ = terminate_on_shutdown; | 92 terminate_child_on_shutdown_ = terminate_on_shutdown; |
93 } | 93 } |
94 | 94 |
95 void UpdateTerminationStatus(bool known_dead); | 95 void UpdateTerminationStatus(bool known_dead); |
96 | 96 |
97 void Close() { process_.Close(); } | 97 void Close() { process_.Close(); } |
98 | 98 |
99 void SetProcessBackgrounded(bool background); | 99 void SetProcessBackgrounded(bool background); |
100 | 100 |
| 101 Client* ReplaceClientForTest(Client* client) { |
| 102 Client* ret = client_; |
| 103 client_ = client; |
| 104 return ret; |
| 105 } |
| 106 |
101 private: | 107 private: |
102 friend class base::RefCountedThreadSafe<ChildProcessLauncher::Context>; | 108 friend class base::RefCountedThreadSafe<ChildProcessLauncher::Context>; |
103 | 109 |
104 ~Context() { | 110 ~Context() { |
105 Terminate(); | 111 Terminate(); |
106 } | 112 } |
107 | 113 |
108 static void RecordHistograms(base::TimeTicks begin_launch_time); | 114 static void RecordHistograms(base::TimeTicks begin_launch_time); |
109 static void RecordLaunchHistograms(base::TimeDelta launch_time); | 115 static void RecordLaunchHistograms(base::TimeDelta launch_time); |
110 | 116 |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { | 622 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { |
617 context_->SetProcessBackgrounded(background); | 623 context_->SetProcessBackgrounded(background); |
618 } | 624 } |
619 | 625 |
620 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 626 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
621 bool terminate_on_shutdown) { | 627 bool terminate_on_shutdown) { |
622 if (context_.get()) | 628 if (context_.get()) |
623 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 629 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
624 } | 630 } |
625 | 631 |
| 632 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
| 633 Client* client) { |
| 634 return context_->ReplaceClientForTest(client); |
| 635 } |
| 636 |
626 } // namespace content | 637 } // namespace content |
OLD | NEW |