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

Unified Diff: components/copresence/copresence_manager_impl.h

Issue 704923002: Add polling and audio check to copresence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: components/copresence/copresence_manager_impl.h
diff --git a/components/copresence/copresence_manager_impl.h b/components/copresence/copresence_manager_impl.h
index ffe690322b62628e1e898dbf512d6149e8006545..8877c68f305ee69a8111eb5c7835232f41fb399c 100644
--- a/components/copresence/copresence_manager_impl.h
+++ b/components/copresence/copresence_manager_impl.h
@@ -13,6 +13,10 @@
#include "base/memory/scoped_vector.h"
#include "components/copresence/public/copresence_manager.h"
+namespace base {
+class Timer;
+}
+
namespace net {
class URLContextGetter;
}
@@ -39,6 +43,7 @@ struct PendingRequest {
// The implementation for CopresenceManager. Responsible primarily for
// client-side initialization. The RpcHandler handles all the details
// of interacting with the server.
+// TODO(rkc): Add tests for this class.
class CopresenceManagerImpl : public CopresenceManager {
public:
~CopresenceManagerImpl() override;
@@ -54,6 +59,14 @@ class CopresenceManagerImpl : public CopresenceManager {
void CompleteInitialization();
void InitStepComplete(const std::string& step, bool success);
+ // This function will be called every kPollTimerIntervalMs milliseconds to
+ // poll the server for new messages.
+ void PollForMessages();
+
+ // This function will verify that we can hear the audio we're playing every
+ // kAudioCheckIntervalMs milliseconds.
+ void AudioCheck();
+
// Belongs to the caller.
CopresenceDelegate* const delegate_;
@@ -63,10 +76,13 @@ class CopresenceManagerImpl : public CopresenceManager {
ScopedVector<PendingRequest> pending_requests_queue_;
- // The RpcHandler depends on the directive handler.
+ // The RpcHandler depends on the directive handler, do not change this order.
scoped_ptr<DirectiveHandler> directive_handler_;
scoped_ptr<RpcHandler> rpc_handler_;
+ scoped_ptr<base::Timer> poll_timer_;
+ scoped_ptr<base::Timer> audio_check_timer_;
+
DISALLOW_COPY_AND_ASSIGN(CopresenceManagerImpl);
};

Powered by Google App Engine
This is Rietveld 408576698