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

Side by Side Diff: base/win/object_watcher.h

Issue 6969077: net: Add NET_API to net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_WIN_OBJECT_WATCHER_H_ 5 #ifndef BASE_WIN_OBJECT_WATCHER_H_
6 #define BASE_WIN_OBJECT_WATCHER_H_ 6 #define BASE_WIN_OBJECT_WATCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
(...skipping 26 matching lines...) Expand all
37 // base::ObjectWatcher watcher_; 37 // base::ObjectWatcher watcher_;
38 // }; 38 // };
39 // 39 //
40 // In the above example, MyClass wants to "do stuff" when object becomes 40 // In the above example, MyClass wants to "do stuff" when object becomes
41 // signaled. ObjectWatcher makes this task easy. When MyClass goes out of 41 // signaled. ObjectWatcher makes this task easy. When MyClass goes out of
42 // scope, the watcher_ will be destroyed, and there is no need to worry about 42 // scope, the watcher_ will be destroyed, and there is no need to worry about
43 // OnObjectSignaled being called on a deleted MyClass pointer. Easy! 43 // OnObjectSignaled being called on a deleted MyClass pointer. Easy!
44 // 44 //
45 class BASE_API ObjectWatcher : public MessageLoop::DestructionObserver { 45 class BASE_API ObjectWatcher : public MessageLoop::DestructionObserver {
46 public: 46 public:
47 class Delegate { 47 class BASE_API Delegate {
48 public: 48 public:
49 virtual ~Delegate() {} 49 virtual ~Delegate() {}
50 // Called from the MessageLoop when a signaled object is detected. To 50 // Called from the MessageLoop when a signaled object is detected. To
51 // continue watching the object, AddWatch must be called again. 51 // continue watching the object, AddWatch must be called again.
52 virtual void OnObjectSignaled(HANDLE object) = 0; 52 virtual void OnObjectSignaled(HANDLE object) = 0;
53 }; 53 };
54 54
55 ObjectWatcher(); 55 ObjectWatcher();
56 ~ObjectWatcher(); 56 ~ObjectWatcher();
57 57
(...skipping 28 matching lines...) Expand all
86 struct Watch; 86 struct Watch;
87 Watch* watch_; 87 Watch* watch_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); 89 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher);
90 }; 90 };
91 91
92 } // namespace win 92 } // namespace win
93 } // namespace base 93 } // namespace base
94 94
95 #endif // BASE_OBJECT_WATCHER_H_ 95 #endif // BASE_OBJECT_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698