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

Side by Side Diff: chrome/common/mach_message_source_mac.h

Issue 3032024: Add undeclared virtual destructors part 2... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | « chrome/common/deprecated/event_sys.h ('k') | chrome/common/sandbox_mac_unittest_helper.h » ('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 (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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_COMMON_MACH_MESSAGE_SOURCE_MAC_H_ 5 #ifndef CHROME_COMMON_MACH_MESSAGE_SOURCE_MAC_H_
6 #define CHROME_COMMON_MACH_MESSAGE_SOURCE_MAC_H_ 6 #define CHROME_COMMON_MACH_MESSAGE_SOURCE_MAC_H_
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 9
10 #include "base/scoped_cftyperef.h" 10 #include "base/scoped_cftyperef.h"
(...skipping 20 matching lines...) Expand all
31 // 31 //
32 // CFRunLoopRun(); // Process messages on runloop... 32 // CFRunLoopRun(); // Process messages on runloop...
33 class MachMessageSource { 33 class MachMessageSource {
34 public: 34 public:
35 // Classes that want to listen on a Mach port can implement 35 // Classes that want to listen on a Mach port can implement
36 // OnMachMessageReceived, |mach_msg| is a pointer to the raw message data and 36 // OnMachMessageReceived, |mach_msg| is a pointer to the raw message data and
37 // |size| is the buffer size; 37 // |size| is the buffer size;
38 class MachPortListener { 38 class MachPortListener {
39 public: 39 public:
40 virtual void OnMachMessageReceived(void* mach_msg, size_t size) = 0; 40 virtual void OnMachMessageReceived(void* mach_msg, size_t size) = 0;
41
42 protected:
43 virtual ~OnMachMessageReceived() {}
41 }; 44 };
42 45
43 // |listener| is a week reference passed to CF, it needs to remain in 46 // |listener| is a week reference passed to CF, it needs to remain in
44 // existence till this object is destroeyd. 47 // existence till this object is destroeyd.
45 MachMessageSource(mach_port_t port, 48 MachMessageSource(mach_port_t port,
46 MachPortListener* listener, 49 MachPortListener* listener,
47 bool* success); 50 bool* success);
48 ~MachMessageSource(); 51 ~MachMessageSource();
49 52
50 private: 53 private:
51 // Called by CF when a new message arrives on the Mach port. 54 // Called by CF when a new message arrives on the Mach port.
52 static void OnReceiveMachMessage(CFMachPortRef port, void* msg, CFIndex size, 55 static void OnReceiveMachMessage(CFMachPortRef port, void* msg, CFIndex size,
53 void* closure); 56 void* closure);
54 57
55 scoped_cftyperef<CFRunLoopSourceRef> machport_runloop_ref_; 58 scoped_cftyperef<CFRunLoopSourceRef> machport_runloop_ref_;
56 DISALLOW_COPY_AND_ASSIGN(MachMessageSource); 59 DISALLOW_COPY_AND_ASSIGN(MachMessageSource);
57 }; 60 };
58 61
59 #endif // CHROME_COMMON_MACH_MESSAGE_SOURCE_MAC_H_ 62 #endif // CHROME_COMMON_MACH_MESSAGE_SOURCE_MAC_H_
OLDNEW
« no previous file with comments | « chrome/common/deprecated/event_sys.h ('k') | chrome/common/sandbox_mac_unittest_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698