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

Unified Diff: child_job.h

Issue 661224: Stop infinite restarting (Closed)
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | child_job.cc » ('j') | child_job.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: child_job.h
diff --git a/child_job.h b/child_job.h
index 08432c8afb057d55fb8e7576768c056542505e39..5dd5b47a6670dce944b05fff9b584d2f34171ffe 100644
--- a/child_job.h
+++ b/child_job.h
@@ -6,6 +6,7 @@
#define LOGIN_MANAGER_CHILD_JOB_H_
#include <gtest/gtest.h>
+#include <time.h>
#include <unistd.h>
#include <base/basictypes.h>
@@ -26,6 +27,12 @@ class ChildJob {
virtual bool ShouldRun() = 0;
+ // ShouldStop() is different from !ShouldRun(). If ShouldStop() returns
+ // true, this means that the parent should tear everything down.
+ virtual bool ShouldStop() = 0;
+
+ virtual void RecordTime() = 0;
+
// Wraps up all the logic of what the job is meant to do. Should NOT return.
virtual void Run() = 0;
@@ -50,6 +57,8 @@ class SetUidExecJob : public ChildJob {
static const int kCantExec;
bool ShouldRun();
+ bool ShouldStop();
+ void RecordTime();
void Run();
void Toggle() { include_login_flag_ = !include_login_flag_; }
@@ -85,6 +94,7 @@ class SetUidExecJob : public ChildJob {
uid_t desired_uid_;
bool include_login_flag_; // This class' piece of toggleable state.
bool set_uid_;
+ time_t last_start_;
FRIEND_TEST(SetUidExecJobTest, FlagAppendTest);
FRIEND_TEST(SetUidExecJobTest, NoFlagAppendTest);
« no previous file with comments | « no previous file | child_job.cc » ('j') | child_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698