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

Side by Side Diff: mojo/public/python/mojo_bindings/messaging.py

Issue 830593003: Update mojo sdk to rev 9fbbc4f0fef1187312316c0ed992342474e139f1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cherry-pick mojo 9d3b8dd17f12d20035a14737fdc38dd926890ff8 Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Utility classes to handle sending and receiving messages.""" 5 """Utility classes to handle sending and receiving messages."""
6 6
7 7
8 import struct 8 import struct
9 import sys 9 import sys
10 import weakref 10 import weakref
11 11
12 import mojo.bindings.serialization as serialization 12 import mojo_bindings.serialization as serialization
13 13
14 # pylint: disable=E0611,F0401 14 # pylint: disable=E0611,F0401
15 import mojo.system as system 15 import mojo_system as system
16 16
17 17
18 # The flag values for a message header. 18 # The flag values for a message header.
19 NO_FLAG = 0 19 NO_FLAG = 0
20 MESSAGE_EXPECTS_RESPONSE_FLAG = 1 << 0 20 MESSAGE_EXPECTS_RESPONSE_FLAG = 1 << 0
21 MESSAGE_IS_RESPONSE_FLAG = 1 << 1 21 MESSAGE_IS_RESPONSE_FLAG = 1 << 1
22 22
23 23
24 class MessagingException(Exception): 24 class MessagingException(Exception):
25 def __init__(self, *args, **kwargs): 25 def __init__(self, *args, **kwargs):
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 message_receiver.Accept(Message(bytearray(), [])) 398 message_receiver.Accept(Message(bytearray(), []))
399 if result != system.RESULT_RESOURCE_EXHAUSTED: 399 if result != system.RESULT_RESOURCE_EXHAUSTED:
400 return result 400 return result
401 (result, data, _) = handle.ReadMessage(bytearray(sizes[0]), sizes[1]) 401 (result, data, _) = handle.ReadMessage(bytearray(sizes[0]), sizes[1])
402 if result == system.RESULT_OK and message_receiver: 402 if result == system.RESULT_OK and message_receiver:
403 message_receiver.Accept(Message(data[0], data[1])) 403 message_receiver.Accept(Message(data[0], data[1]))
404 return result 404 return result
405 405
406 def _HasRequestId(flags): 406 def _HasRequestId(flags):
407 return flags & (MESSAGE_EXPECTS_RESPONSE_FLAG|MESSAGE_IS_RESPONSE_FLAG) != 0 407 return flags & (MESSAGE_EXPECTS_RESPONSE_FLAG|MESSAGE_IS_RESPONSE_FLAG) != 0
OLDNEW
« no previous file with comments | « mojo/public/python/mojo_bindings/descriptor.py ('k') | mojo/public/python/mojo_bindings/promise.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698