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

Side by Side Diff: chromeos/binder/command_broker.h

Issue 1575313002: Add CommandBroker::OnTransaction to handle incoming transactions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | chromeos/binder/command_broker.cc » ('j') | chromeos/binder/command_broker.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROMEOS_BINDER_COMMAND_BROKER_H_ 5 #ifndef CHROMEOS_BINDER_COMMAND_BROKER_H_
6 #define CHROMEOS_BINDER_COMMAND_BROKER_H_ 6 #define CHROMEOS_BINDER_COMMAND_BROKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 14 matching lines...) Expand all
25 // Issues appropriate outgoing commands to perform required tasks, and 25 // Issues appropriate outgoing commands to perform required tasks, and
26 // dispatches incoming commands to appropriate objects. 26 // dispatches incoming commands to appropriate objects.
27 // Usually this class lives as long as the corresponding thread. 27 // Usually this class lives as long as the corresponding thread.
28 // TODO(hashimoto): Add code to handle incoming commands (e.g. transactions). 28 // TODO(hashimoto): Add code to handle incoming commands (e.g. transactions).
29 class CHROMEOS_EXPORT CommandBroker 29 class CHROMEOS_EXPORT CommandBroker
30 : public CommandStream::IncomingCommandHandler { 30 : public CommandStream::IncomingCommandHandler {
31 public: 31 public:
32 explicit CommandBroker(Driver* driver); 32 explicit CommandBroker(Driver* driver);
33 ~CommandBroker() override; 33 ~CommandBroker() override;
34 34
35 // Tells the driver that the current thread entered command handling loop.
satorux1 2016/01/13 04:33:20 Please document the return value here and elsewher
hashimoto 2016/01/13 05:46:46 Done.
36 bool EnterLooper();
37
38 // Tells the driver that the current thread exited command handling loop.
39 bool ExitLooper();
40
41 // Fetches incoming commands and handles them.
42 bool PollCommands();
43
35 // Performs transaction with the remote object specified by the handle. 44 // Performs transaction with the remote object specified by the handle.
36 // Returns true on success. If not one-way transaction, this method blocks 45 // Returns true on success. If not one-way transaction, this method blocks
37 // until the target object sends a reply. 46 // until the target object sends a reply.
38 bool Transact(int32_t handle, 47 bool Transact(int32_t handle,
39 const TransactionData& request, 48 const TransactionData& request,
40 scoped_ptr<TransactionData>* reply); 49 scoped_ptr<TransactionData>* reply);
41 50
42 // Increments the ref-count of a remote object specified by |handle|. 51 // Increments the ref-count of a remote object specified by |handle|.
43 void AddReference(int32_t handle); 52 void AddReference(int32_t handle);
44 53
45 // Decrements the ref-count of a remote object specified by |handle|. 54 // Decrements the ref-count of a remote object specified by |handle|.
46 void ReleaseReference(int32_t handle); 55 void ReleaseReference(int32_t handle);
47 56
48 // Returns a closure which decrements the ref-count of a remote object. 57 // Returns a closure which decrements the ref-count of a remote object.
49 // It's safe to run the returned closure even after the destruction of this 58 // It's safe to run the returned closure even after the destruction of this
50 // object. 59 // object.
51 base::Closure GetReleaseReferenceClosure(int32_t handle); 60 base::Closure GetReleaseReferenceClosure(int32_t handle);
52 61
53 // CommandStream::IncomingCommandHandler override: 62 // CommandStream::IncomingCommandHandler override:
63 bool OnTransaction(const TransactionData& data) override;
54 void OnReply(scoped_ptr<TransactionData> data) override; 64 void OnReply(scoped_ptr<TransactionData> data) override;
55 void OnDeadReply() override; 65 void OnDeadReply() override;
56 void OnTransactionComplete() override; 66 void OnTransactionComplete() override;
57 void OnIncrementWeakReference(void* ptr, void* cookie) override; 67 void OnIncrementWeakReference(void* ptr, void* cookie) override;
58 void OnIncrementStrongReference(void* ptr, void* cookie) override; 68 void OnIncrementStrongReference(void* ptr, void* cookie) override;
59 void OnDecrementStrongReference(void* ptr, void* cookie) override; 69 void OnDecrementStrongReference(void* ptr, void* cookie) override;
60 void OnDecrementWeakReference(void* ptr, void* cookie) override; 70 void OnDecrementWeakReference(void* ptr, void* cookie) override;
61 void OnFailedReply() override; 71 void OnFailedReply() override;
62 72
63 private: 73 private:
(...skipping 15 matching lines...) Expand all
79 scoped_ptr<TransactionData> response_data_; 89 scoped_ptr<TransactionData> response_data_;
80 90
81 base::WeakPtrFactory<CommandBroker> weak_ptr_factory_; 91 base::WeakPtrFactory<CommandBroker> weak_ptr_factory_;
82 92
83 DISALLOW_COPY_AND_ASSIGN(CommandBroker); 93 DISALLOW_COPY_AND_ASSIGN(CommandBroker);
84 }; 94 };
85 95
86 } // namespace binder 96 } // namespace binder
87 97
88 #endif // CHROMEOS_BINDER_COMMAND_BROKER_H_ 98 #endif // CHROMEOS_BINDER_COMMAND_BROKER_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/binder/command_broker.cc » ('j') | chromeos/binder/command_broker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698