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

Side by Side Diff: chrome/test/base/layout_test_http_server.cc

Issue 8667006: Extract similar code into SetJobObjectAsKillOnJobClose() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years 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
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | chrome/test/ui/ui_test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/base/layout_test_http_server.h" 5 #include "chrome/test/base/layout_test_http_server.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // work around this, we start the http server on the background mode. 80 // work around this, we start the http server on the background mode.
81 if (base::win::GetVersion() >= base::win::VERSION_WIN7) 81 if (base::win::GetVersion() >= base::win::VERSION_WIN7)
82 cmd_line.AppendArg("--run_background"); 82 cmd_line.AppendArg("--run_background");
83 83
84 job_handle_.Set(CreateJobObject(NULL, NULL)); 84 job_handle_.Set(CreateJobObject(NULL, NULL));
85 if (!job_handle_.IsValid()) { 85 if (!job_handle_.IsValid()) {
86 LOG(ERROR) << "Could not create JobObject."; 86 LOG(ERROR) << "Could not create JobObject.";
87 return false; 87 return false;
88 } 88 }
89 89
90 JOBOBJECT_EXTENDED_LIMIT_INFORMATION limit_info = {0}; 90 if (!base::SetJobObjectAsKillOnJobClose(job_handle_.Get())) {
91 limit_info.BasicLimitInformation.LimitFlags =
92 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
93 if (0 == SetInformationJobObject(job_handle_.Get(),
94 JobObjectExtendedLimitInformation, &limit_info, sizeof(limit_info))) {
95 LOG(ERROR) << "Could not SetInformationJobObject."; 91 LOG(ERROR) << "Could not SetInformationJobObject.";
96 return false; 92 return false;
97 } 93 }
98 #endif 94 #endif
99 95
100 // The Python script waits for the server to start responding to requests, 96 // The Python script waits for the server to start responding to requests,
101 // then exits. So we want to wait for the Python script to exit before 97 // then exits. So we want to wait for the Python script to exit before
102 // continuing. 98 // continuing.
103 base::LaunchOptions options; 99 base::LaunchOptions options;
104 options.wait = true; 100 options.wait = true;
(...skipping 24 matching lines...) Expand all
129 running_ = !stopped; 125 running_ = !stopped;
130 126
131 #if defined(OS_WIN) 127 #if defined(OS_WIN)
132 // Close the job object handle now. This should clean up 128 // Close the job object handle now. This should clean up
133 // any orphaned processes. 129 // any orphaned processes.
134 job_handle_.Close(); 130 job_handle_.Close();
135 #endif 131 #endif
136 132
137 return stopped; 133 return stopped;
138 } 134 }
139
OLDNEW
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | chrome/test/ui/ui_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698