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

Side by Side Diff: extensions/browser/extension_message_filter.h

Issue 309123002: extensions: Destroy ExtensionMessageFilter on IO thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply review feedback Created 6 years, 6 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
« no previous file with comments | « no previous file | extensions/browser/extension_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ 6 #define EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 // renderer process. It is created on the UI thread. Messages may be handled on 31 // renderer process. It is created on the UI thread. Messages may be handled on
32 // the IO thread or the UI thread. 32 // the IO thread or the UI thread.
33 class ExtensionMessageFilter : public content::BrowserMessageFilter { 33 class ExtensionMessageFilter : public content::BrowserMessageFilter {
34 public: 34 public:
35 ExtensionMessageFilter(int render_process_id, 35 ExtensionMessageFilter(int render_process_id,
36 content::BrowserContext* context); 36 content::BrowserContext* context);
37 37
38 int render_process_id() { return render_process_id_; } 38 int render_process_id() { return render_process_id_; }
39 39
40 private: 40 private:
41 friend class content::BrowserThread;
42 friend class base::DeleteHelper<ExtensionMessageFilter>;
43
41 virtual ~ExtensionMessageFilter(); 44 virtual ~ExtensionMessageFilter();
42 45
43 // content::BrowserMessageFilter implementation. 46 // content::BrowserMessageFilter implementation.
44 virtual void OverrideThreadForMessage( 47 virtual void OverrideThreadForMessage(
45 const IPC::Message& message, 48 const IPC::Message& message,
46 content::BrowserThread::ID* thread) OVERRIDE; 49 content::BrowserThread::ID* thread) OVERRIDE;
50 virtual void OnDestruct() const OVERRIDE;
47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
48 52
49 // Message handlers on the UI thread. 53 // Message handlers on the UI thread.
50 void OnExtensionAddListener(const std::string& extension_id, 54 void OnExtensionAddListener(const std::string& extension_id,
51 const std::string& event_name); 55 const std::string& event_name);
52 void OnExtensionRemoveListener(const std::string& extension_id, 56 void OnExtensionRemoveListener(const std::string& extension_id,
53 const std::string& event_name); 57 const std::string& event_name);
54 void OnExtensionAddLazyListener(const std::string& extension_id, 58 void OnExtensionAddLazyListener(const std::string& extension_id,
55 const std::string& event_name); 59 const std::string& event_name);
56 void OnExtensionRemoveLazyListener(const std::string& extension_id, 60 void OnExtensionRemoveLazyListener(const std::string& extension_id,
(...skipping 18 matching lines...) Expand all
75 int routing_id, 79 int routing_id,
76 const ExtensionHostMsg_Request_Params& params); 80 const ExtensionHostMsg_Request_Params& params);
77 81
78 const int render_process_id_; 82 const int render_process_id_;
79 83
80 // Should only be accessed on the UI thread. 84 // Should only be accessed on the UI thread.
81 content::BrowserContext* browser_context_; 85 content::BrowserContext* browser_context_;
82 86
83 scoped_refptr<extensions::InfoMap> extension_info_map_; 87 scoped_refptr<extensions::InfoMap> extension_info_map_;
84 88
89 // Weak pointers produced by this factory are bound to the IO thread.
85 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_; 90 base::WeakPtrFactory<ExtensionMessageFilter> weak_ptr_factory_;
86 91
87 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter); 92 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageFilter);
88 }; 93 };
89 94
90 } // namespace extensions 95 } // namespace extensions
91 96
92 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_ 97 #endif // EXTENSIONS_BROWSER_EXTENSION_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/extension_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698