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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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
OLDNEW
1 # Copyright (C) 2011 Google Inc. All rights reserved. 1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 class _Message(object): 190 class _Message(object):
191 191
192 def __init__(self, src, message_name, message_args, from_user, logs): 192 def __init__(self, src, message_name, message_args, from_user, logs):
193 self.src = src 193 self.src = src
194 self.name = message_name 194 self.name = message_name
195 self.args = message_args 195 self.args = message_args
196 self.from_user = from_user 196 self.from_user = from_user
197 self.logs = logs 197 self.logs = logs
198 198
199 def __repr__(self): 199 def __repr__(self):
200 return '_Message(src=%s, name=%s, args=%s, from_user=%s, logs=%s)' % (se lf.src, self.name, self.args, self.from_user, self.logs) 200 return '_Message(src=%s, name=%s, args=%s, from_user=%s, logs=%s)' % (
201 self.src, self.name, self.args, self.from_user, self.logs)
201 202
202 203
203 class _Worker(multiprocessing.Process): 204 class _Worker(multiprocessing.Process):
204 205
205 def __init__(self, host, messages_to_manager, messages_to_worker, worker_fac tory, worker_number, running_inline, manager, log_level): 206 def __init__(self, host, messages_to_manager, messages_to_worker,
207 worker_factory, worker_number, running_inline, manager, log_lev el):
206 super(_Worker, self).__init__() 208 super(_Worker, self).__init__()
207 self.host = host 209 self.host = host
208 self.worker_number = worker_number 210 self.worker_number = worker_number
209 self.name = 'worker/%d' % worker_number 211 self.name = 'worker/%d' % worker_number
210 self.log_messages = [] 212 self.log_messages = []
211 self.log_level = log_level 213 self.log_level = log_level
212 self._running = False 214 self._running = False
213 self._running_inline = running_inline 215 self._running_inline = running_inline
214 self._manager = manager 216 self._manager = manager
215 217
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if message.from_user: 258 if message.from_user:
257 worker.handle(message.name, message.src, *message.args) 259 worker.handle(message.name, message.src, *message.args)
258 self._yield_to_manager() 260 self._yield_to_manager()
259 else: 261 else:
260 assert message.name == 'stop', 'bad message %s' % repr(messa ge) 262 assert message.name == 'stop', 'bad message %s' % repr(messa ge)
261 break 263 break
262 264
263 _log.debug("%s exiting" % self.name) 265 _log.debug("%s exiting" % self.name)
264 except Queue.Empty: 266 except Queue.Empty:
265 assert False, '%s: ran out of messages in worker queue.' % self.name 267 assert False, '%s: ran out of messages in worker queue.' % self.name
266 except KeyboardInterrupt, e: 268 except KeyboardInterrupt as e:
267 self._raise(sys.exc_info()) 269 self._raise(sys.exc_info())
268 except Exception, e: 270 except Exception as e:
269 self._raise(sys.exc_info()) 271 self._raise(sys.exc_info())
270 finally: 272 finally:
271 try: 273 try:
272 if hasattr(worker, 'stop'): 274 if hasattr(worker, 'stop'):
273 worker.stop() 275 worker.stop()
274 finally: 276 finally:
275 self._post(name='done', args=(), from_user=False) 277 self._post(name='done', args=(), from_user=False)
276 self._close() 278 self._close()
277 279
278 def stop_running(self): 280 def stop_running(self):
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 323
322 class _WorkerLogHandler(logging.Handler): 324 class _WorkerLogHandler(logging.Handler):
323 325
324 def __init__(self, worker): 326 def __init__(self, worker):
325 logging.Handler.__init__(self) 327 logging.Handler.__init__(self)
326 self._worker = worker 328 self._worker = worker
327 self.setLevel(worker.log_level) 329 self.setLevel(worker.log_level)
328 330
329 def emit(self, record): 331 def emit(self, record):
330 self._worker.log_messages.append(record) 332 self._worker.log_messages.append(record)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698