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

Side by Side Diff: gclient_utils.py

Issue 3338017: Enter a description of the change. (Closed)
Patch Set: Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2009 Google Inc. All Rights Reserved. 1 # Copyright 2009 Google Inc. All Rights Reserved.
2 # 2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); 3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License. 4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at 5 # You may obtain a copy of the License at
6 # 6 #
7 # http://www.apache.org/licenses/LICENSE-2.0 7 # http://www.apache.org/licenses/LICENSE-2.0
8 # 8 #
9 # Unless required by applicable law or agreed to in writing, software 9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, 10 # distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 self.lock = threading.Lock() 291 self.lock = threading.Lock()
292 self.stdout = stdout 292 self.stdout = stdout
293 self.delay = delay 293 self.delay = delay
294 self.last_flushed_at = time.time() 294 self.last_flushed_at = time.time()
295 self.stdout.flush() 295 self.stdout.flush()
296 296
297 def write(self, out): 297 def write(self, out):
298 """Thread-safe.""" 298 """Thread-safe."""
299 self.stdout.write(out) 299 self.stdout.write(out)
300 should_flush = False 300 should_flush = False
301 with self.lock: 301 self.lock.acquire()
302 try:
302 if (time.time() - self.last_flushed_at) > self.delay: 303 if (time.time() - self.last_flushed_at) > self.delay:
303 should_flush = True 304 should_flush = True
304 self.last_flushed_at = time.time() 305 self.last_flushed_at = time.time()
306 finally:
307 self.lock.release()
305 if should_flush: 308 if should_flush:
306 self.stdout.flush() 309 self.stdout.flush()
307 310
308 def flush(self): 311 def flush(self):
309 self.stdout.flush() 312 self.stdout.flush()
310 313
311 314
312 def CheckCallAndFilter(args, stdout=None, filter_fn=None, 315 def CheckCallAndFilter(args, stdout=None, filter_fn=None,
313 print_stdout=None, call_filter_on_first_line=False, 316 print_stdout=None, call_filter_on_first_line=False,
314 **kwargs): 317 **kwargs):
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if exception: 584 if exception:
582 self.parent.exceptions.append(exception) 585 self.parent.exceptions.append(exception)
583 if self.parent.progress: 586 if self.parent.progress:
584 self.parent.progress.update(1) 587 self.parent.progress.update(1)
585 assert not self.item.name in self.parent.ran 588 assert not self.item.name in self.parent.ran
586 if not self.item.name in self.parent.ran: 589 if not self.item.name in self.parent.ran:
587 self.parent.ran.append(self.item.name) 590 self.parent.ran.append(self.item.name)
588 finally: 591 finally:
589 self.parent.ready_cond.notifyAll() 592 self.parent.ready_cond.notifyAll()
590 self.parent.ready_cond.release() 593 self.parent.ready_cond.release()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698