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

Side by Side Diff: components/copresence/copresence_manager_impl.h

Issue 684273004: Moving the DirectiveHandler to be owned by CopresenceManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using EXPECT_THAT Created 6 years, 1 month 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 #ifndef COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ 5 #ifndef COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
6 #define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ 6 #define COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
10 9
11 #include "base/callback.h"
12 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
13 #include "base/macros.h" 11 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
16 #include "components/copresence/proto/rpcs.pb.h"
17 #include "components/copresence/public/copresence_manager.h" 14 #include "components/copresence/public/copresence_manager.h"
18 15
19 namespace net { 16 namespace net {
20 class URLContextGetter; 17 class URLContextGetter;
21 } 18 }
22 19
23 namespace copresence { 20 namespace copresence {
24 21
22 class DirectiveHandler;
23 class ReportRequest;
25 class RpcHandler; 24 class RpcHandler;
26 25
27 struct PendingRequest { 26 struct PendingRequest {
28 PendingRequest(const ReportRequest& report, 27 PendingRequest(const ReportRequest& report,
29 const std::string& app_id, 28 const std::string& app_id,
30 const std::string& auth_token, 29 const std::string& auth_token,
31 const StatusCallback& callback); 30 const StatusCallback& callback);
32 ~PendingRequest(); 31 ~PendingRequest();
33 32
34 scoped_ptr<ReportRequest> report; 33 scoped_ptr<ReportRequest> report;
(...skipping 13 matching lines...) Expand all
48 const StatusCallback& callback) override; 47 const StatusCallback& callback) override;
49 48
50 private: 49 private:
51 // Create managers with the CopresenceManager::Create() method. 50 // Create managers with the CopresenceManager::Create() method.
52 friend class CopresenceManager; 51 friend class CopresenceManager;
53 CopresenceManagerImpl(CopresenceDelegate* delegate); 52 CopresenceManagerImpl(CopresenceDelegate* delegate);
54 53
55 void CompleteInitialization(); 54 void CompleteInitialization();
56 void InitStepComplete(const std::string& step, bool success); 55 void InitStepComplete(const std::string& step, bool success);
57 56
57 // Belongs to the caller.
58 CopresenceDelegate* const delegate_;
59
60 int pending_init_operations_;
61 base::CancelableCallback<void(bool)> whispernet_init_callback_;
58 bool init_failed_; 62 bool init_failed_;
63
59 ScopedVector<PendingRequest> pending_requests_queue_; 64 ScopedVector<PendingRequest> pending_requests_queue_;
60 65
61 base::CancelableCallback<void(bool)> whispernet_init_callback_; 66 // The RpcHandler depends on the directive handler.
62 67 scoped_ptr<DirectiveHandler> directive_handler_;
63 // TODO(rkc): This code is almost identical to what we use in feedback to
64 // perform multiple blocking tasks and then run a post process method. Look
65 // into refactoring it all out to a common construct, like maybe a
66 // PostMultipleTasksAndReply?
67 int pending_init_operations_;
68
69 CopresenceDelegate* const delegate_;
70 scoped_ptr<RpcHandler> rpc_handler_; 68 scoped_ptr<RpcHandler> rpc_handler_;
71 69
72 DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl); 70 DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl);
73 }; 71 };
74 72
75 } // namespace copresence 73 } // namespace copresence
76 74
77 #endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_ 75 #endif // COMPONENTS_COPRESENCE_COPRESENCE_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | components/copresence/copresence_manager_impl.cc » ('j') | components/copresence/copresence_manager_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698