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

Side by Side Diff: content/public/browser/browser_child_process_host_iterator.h

Issue 12662019: Split the ProcessType enum into process types that content knows about (which will remain in src\co… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_ 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/public/common/process_type.h"
12 11
13 namespace IPC { 12 namespace IPC {
14 class Message; 13 class Message;
15 } 14 }
16 15
17 namespace content { 16 namespace content {
18 class BrowserChildProcessHostDelegate; 17 class BrowserChildProcessHostDelegate;
19 class BrowserChildProcessHostImpl; 18 class BrowserChildProcessHostImpl;
20 struct ChildProcessData; 19 struct ChildProcessData;
21 20
22 // This class allows iteration through either all child processes, or ones of a 21 // This class allows iteration through either all child processes, or ones of a
23 // specific type, depending on which constructor is used. Note that this should 22 // specific type, depending on which constructor is used. Note that this should
24 // be done from the IO thread and that the iterator should not be kept around as 23 // be done from the IO thread and that the iterator should not be kept around as
25 // it may be invalidated on subsequent event processing in the event loop. 24 // it may be invalidated on subsequent event processing in the event loop.
26 class CONTENT_EXPORT BrowserChildProcessHostIterator { 25 class CONTENT_EXPORT BrowserChildProcessHostIterator {
27 public: 26 public:
28 BrowserChildProcessHostIterator(); 27 BrowserChildProcessHostIterator();
29 explicit BrowserChildProcessHostIterator(content::ProcessType type); 28 explicit BrowserChildProcessHostIterator(int type);
30 29
31 // These methods work on the current iterator object. Only call them if 30 // These methods work on the current iterator object. Only call them if
32 // Done() returns false. 31 // Done() returns false.
33 bool operator++(); 32 bool operator++();
34 bool Done(); 33 bool Done();
35 const ChildProcessData& GetData(); 34 const ChildProcessData& GetData();
36 bool Send(IPC::Message* message); 35 bool Send(IPC::Message* message);
37 BrowserChildProcessHostDelegate* GetDelegate(); 36 BrowserChildProcessHostDelegate* GetDelegate();
38 37
39 private: 38 private:
40 bool all_; 39 bool all_;
41 content::ProcessType type_; 40 int process_type_;
42 std::list<BrowserChildProcessHostImpl*>::iterator iterator_; 41 std::list<BrowserChildProcessHostImpl*>::iterator iterator_;
43 }; 42 };
44 43
45 // Helper class so that subclasses of BrowserChildProcessHostDelegate can be 44 // Helper class so that subclasses of BrowserChildProcessHostDelegate can be
46 // iterated with no casting needing. Note that because of the components build, 45 // iterated with no casting needing. Note that because of the components build,
47 // this class can only be used by BCPHD implementations that live in content, 46 // this class can only be used by BCPHD implementations that live in content,
48 // otherwise link errors will result. 47 // otherwise link errors will result.
49 template <class T> 48 template <class T>
50 class CONTENT_EXPORT BrowserChildProcessHostTypeIterator 49 class CONTENT_EXPORT BrowserChildProcessHostTypeIterator
51 : public BrowserChildProcessHostIterator { 50 : public BrowserChildProcessHostIterator {
52 public: 51 public:
53 explicit BrowserChildProcessHostTypeIterator(content::ProcessType type) 52 explicit BrowserChildProcessHostTypeIterator(int process_type)
54 : BrowserChildProcessHostIterator(type) {} 53 : BrowserChildProcessHostIterator(process_type) {}
55 T* operator->() { 54 T* operator->() {
56 return static_cast<T*>(GetDelegate()); 55 return static_cast<T*>(GetDelegate());
57 } 56 }
58 T* operator*() { 57 T* operator*() {
59 return static_cast<T*>(GetDelegate()); 58 return static_cast<T*>(GetDelegate());
60 } 59 }
61 }; 60 };
62 61
63 }; // namespace content 62 }; // namespace content
64 63
65 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_ 64 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_ITERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698