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

Unified Diff: extensions/browser/api/cast_channel/cast_channel_api.h

Issue 555283002: Create new class "CastTransport", which encapsulates the message read and write event loops. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed wez's feedback. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/cast_channel/cast_channel_api.h
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.h b/extensions/browser/api/cast_channel/cast_channel_api.h
index ebb3173a54e97c02d9f1877b25df8fc3bf126bb9..e25df10d5a1139db6eb5aa6f64c67ad5d73addcc 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.h
+++ b/extensions/browser/api/cast_channel/cast_channel_api.h
@@ -39,7 +39,7 @@ class Logger;
namespace cast_channel = core_api::cast_channel;
class CastChannelAPI : public BrowserContextKeyedAPI,
- public cast_channel::CastSocket::Delegate {
+ public cast_channel::CastSocketImpl::Delegate {
public:
explicit CastChannelAPI(content::BrowserContext* context);
@@ -48,9 +48,10 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<CastChannelAPI>* GetFactoryInstance();
- // Returns a new CastSocket that connects to |ip_endpoint| with authentication
+ // Returns a new CastSocketImpl that connects to |ip_endpoint| with
+ // authentication
// |channel_auth| and is to be owned by |extension_id|.
- scoped_ptr<cast_channel::CastSocket> CreateCastSocket(
+ scoped_ptr<cast_channel::CastSocketImpl> CreateCastSocketImpl(
Wez 2014/09/20 00:41:30 Ick... OK, this ends up being really ugly since th
Kevin M 2014/09/22 19:56:51 I would prefer to do it in a followup CL. I'll add
const std::string& extension_id,
const net::IPEndPoint& ip_endpoint,
cast_channel::ChannelAuthType channel_auth,
@@ -58,14 +59,16 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
// Returns a pointer to the Logger member variable.
// TODO(imcheng): Consider whether it is possible for this class to own the
- // CastSockets and make this class the sole owner of Logger. Alternatively,
+ // CastSocketImpls and make this class the sole owner of Logger.
+ // Alternatively,
// consider making Logger not ref-counted by passing a weak
- // reference of Logger to the CastSockets instead.
+ // reference of Logger to the CastSocketImpls instead.
scoped_refptr<cast_channel::Logger> GetLogger();
- // Sets the CastSocket instance to be returned by CreateCastSocket for
+ // Sets the CastSocketImpl instance to be returned by CreateCastSocketImpl for
// testing.
- void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test);
+ void SetSocketForTest(
+ scoped_ptr<cast_channel::CastSocketImpl> socket_for_test);
private:
friend class BrowserContextKeyedAPIFactory<CastChannelAPI>;
@@ -73,11 +76,11 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
virtual ~CastChannelAPI();
- // CastSocket::Delegate. Called on IO thread.
- virtual void OnError(const cast_channel::CastSocket* socket,
+ // CastSocketImpl::Delegate. Called on IO thread.
+ virtual void OnError(const cast_channel::CastSocketImpl* socket,
cast_channel::ChannelError error_state,
const cast_channel::LastErrors& last_errors) OVERRIDE;
- virtual void OnMessage(const cast_channel::CastSocket* socket,
+ virtual void OnMessage(const cast_channel::CastSocketImpl* socket,
const cast_channel::MessageInfo& message) OVERRIDE;
// BrowserContextKeyedAPI implementation.
@@ -85,7 +88,7 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
content::BrowserContext* const browser_context_;
scoped_refptr<cast_channel::Logger> logger_;
- scoped_ptr<cast_channel::CastSocket> socket_for_test_;
+ scoped_ptr<cast_channel::CastSocketImpl> socket_for_test_;
DISALLOW_COPY_AND_ASSIGN(CastChannelAPI);
};
@@ -104,19 +107,19 @@ class CastChannelAsyncApiFunction : public AsyncApiFunction {
// Returns the socket corresponding to |channel_id| if one exists. Otherwise,
// sets the function result with CHANNEL_ERROR_INVALID_CHANNEL_ID, completes
// the function, and returns null.
- cast_channel::CastSocket* GetSocketOrCompleteWithError(int channel_id);
+ cast_channel::CastSocketImpl* GetSocketOrCompleteWithError(int channel_id);
// Adds |socket| to |manager_| and returns the new channel_id. |manager_|
// assumes ownership of |socket|.
- int AddSocket(cast_channel::CastSocket* socket);
+ int AddSocket(cast_channel::CastSocketImpl* socket);
- // Removes the CastSocket corresponding to |channel_id| from the resource
+ // Removes the CastSocketImpl corresponding to |channel_id| from the resource
// manager.
void RemoveSocket(int channel_id);
// Sets the function result to a ChannelInfo obtained from the state of
// |socket|.
- void SetResultFromSocket(const cast_channel::CastSocket& socket);
+ void SetResultFromSocket(const cast_channel::CastSocketImpl& socket);
// Sets the function result to a ChannelInfo populated with |channel_id| and
// |error|.
@@ -124,14 +127,14 @@ class CastChannelAsyncApiFunction : public AsyncApiFunction {
// Returns the socket corresponding to |channel_id| if one exists, or null
// otherwise.
- cast_channel::CastSocket* GetSocket(int channel_id);
+ cast_channel::CastSocketImpl* GetSocket(int channel_id);
private:
// Sets the function result from |channel_info|.
void SetResultFromChannelInfo(const cast_channel::ChannelInfo& channel_info);
- // The API resource manager for CastSockets.
- ApiResourceManager<cast_channel::CastSocket>* manager_;
+ // The API resource manager for CastSocketImpls.
+ ApiResourceManager<cast_channel::CastSocketImpl>* manager_;
// The result of the function.
cast_channel::ChannelError error_;

Powered by Google App Engine
This is Rietveld 408576698