| OLD | NEW |
| 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "mojo/public/cpp/bindings/bindings_export.h" |
| 14 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 15 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 | 18 |
| 18 class Message; | 19 class Message; |
| 19 | 20 |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| 22 #pragma pack(push, 1) | 23 #pragma pack(push, 1) |
| 23 | 24 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 struct MessageHeaderWithRequestID : MessageHeader { | 38 struct MessageHeaderWithRequestID : MessageHeader { |
| 38 // Only used if either kFlagExpectsResponse or kFlagIsResponse is set in | 39 // Only used if either kFlagExpectsResponse or kFlagIsResponse is set in |
| 39 // order to match responses with corresponding requests. | 40 // order to match responses with corresponding requests. |
| 40 uint64_t request_id; | 41 uint64_t request_id; |
| 41 }; | 42 }; |
| 42 static_assert(sizeof(MessageHeaderWithRequestID) == 32, | 43 static_assert(sizeof(MessageHeaderWithRequestID) == 32, |
| 43 "Bad sizeof(MessageHeaderWithRequestID)"); | 44 "Bad sizeof(MessageHeaderWithRequestID)"); |
| 44 | 45 |
| 45 #pragma pack(pop) | 46 #pragma pack(pop) |
| 46 | 47 |
| 47 class MessageDispatchContext { | 48 class MOJO_CPP_BINDINGS_EXPORT MessageDispatchContext { |
| 48 public: | 49 public: |
| 49 explicit MessageDispatchContext(Message* message); | 50 explicit MessageDispatchContext(Message* message); |
| 50 ~MessageDispatchContext(); | 51 ~MessageDispatchContext(); |
| 51 | 52 |
| 52 static MessageDispatchContext* current(); | 53 static MessageDispatchContext* current(); |
| 53 | 54 |
| 54 const base::Callback<void(const std::string&)>& GetBadMessageCallback(); | 55 const base::Callback<void(const std::string&)>& GetBadMessageCallback(); |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 MessageDispatchContext* outer_context_; | 58 MessageDispatchContext* outer_context_; |
| 58 Message* message_; | 59 Message* message_; |
| 59 base::Callback<void(const std::string&)> bad_message_callback_; | 60 base::Callback<void(const std::string&)> bad_message_callback_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(MessageDispatchContext); | 62 DISALLOW_COPY_AND_ASSIGN(MessageDispatchContext); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 class SyncMessageResponseSetup { | 65 class MOJO_CPP_BINDINGS_EXPORT SyncMessageResponseSetup { |
| 65 public: | 66 public: |
| 66 static void SetCurrentSyncResponseMessage(Message* message); | 67 static void SetCurrentSyncResponseMessage(Message* message); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace internal | 70 } // namespace internal |
| 70 } // namespace mojo | 71 } // namespace mojo |
| 71 | 72 |
| 72 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 73 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| OLD | NEW |