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

Side by Side Diff: apps/app_shim/app_shim_host_manager_mac.h

Issue 20065004: Make AppShimHostManager a RefCountedThreadSafe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_ 5 #ifndef CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_
6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_ 6 #define CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_
7 7
8 #include "apps/app_shim/extension_app_shim_handler_mac.h" 8 #include "apps/app_shim/extension_app_shim_handler_mac.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/ref_counted.h"
10 #include "ipc/ipc_channel_factory.h" 10 #include "ipc/ipc_channel_factory.h"
11 11
12 // The AppShimHostManager receives connections from app shims on a UNIX 12 // The AppShimHostManager receives connections from app shims on a UNIX
13 // socket (|factory_|) and creates a helper object to manage the connection. 13 // socket (|factory_|) and creates a helper object to manage the connection.
14 class AppShimHostManager 14 class AppShimHostManager
15 : public IPC::ChannelFactory::Delegate, 15 : public IPC::ChannelFactory::Delegate,
16 public base::SupportsWeakPtr<AppShimHostManager> { 16 public base::RefCountedThreadSafe<AppShimHostManager> {
17 public: 17 public:
18 AppShimHostManager(); 18 AppShimHostManager();
19 virtual ~AppShimHostManager();
20 19
21 apps::ExtensionAppShimHandler* extension_app_shim_handler() { 20 apps::ExtensionAppShimHandler* extension_app_shim_handler() {
22 return &extension_app_shim_handler_; 21 return &extension_app_shim_handler_;
23 } 22 }
24 23
25 private: 24 private:
25 friend class base::RefCountedThreadSafe<AppShimHostManager>;
26 virtual ~AppShimHostManager();
27
26 // IPC::ChannelFactory::Delegate implementation. 28 // IPC::ChannelFactory::Delegate implementation.
27 virtual void OnClientConnected(const IPC::ChannelHandle& handle) OVERRIDE; 29 virtual void OnClientConnected(const IPC::ChannelHandle& handle) OVERRIDE;
28 virtual void OnListenError() OVERRIDE; 30 virtual void OnListenError() OVERRIDE;
29 31
30 // The |factory_| must be created on a thread which allows blocking I/O, so 32 // The |factory_| must be created on a thread which allows blocking I/O, so
31 // part of the initialization of this class must be carried out on the file 33 // part of the initialization of this class must be carried out on the file
32 // thread. 34 // thread.
33 void InitOnFileThread(); 35 void InitOnFileThread();
34 36
35 // Called on the IO thread to begin listening for connections from app shims. 37 // Called on the IO thread to begin listening for connections from app shims.
36 void ListenOnIOThread(); 38 void ListenOnIOThread();
37 39
38 scoped_ptr<IPC::ChannelFactory> factory_; 40 scoped_ptr<IPC::ChannelFactory> factory_;
39 41
40 apps::ExtensionAppShimHandler extension_app_shim_handler_; 42 apps::ExtensionAppShimHandler extension_app_shim_handler_;
41 43
42 DISALLOW_COPY_AND_ASSIGN(AppShimHostManager); 44 DISALLOW_COPY_AND_ASSIGN(AppShimHostManager);
43 }; 45 };
44 46
45 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_ 47 #endif // CHROME_BROWSER_WEB_APPLICATIONS_APP_SHIM_HOST_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | apps/app_shim/app_shim_host_manager_mac.mm » ('j') | apps/app_shim/app_shim_host_manager_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698