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

Side by Side Diff: net/base/network_config_watcher_mac.cc

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « net/base/network_config_watcher_mac.h ('k') | net/base/platform_mime_util_mac.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "net/base/network_config_watcher_mac.h" 5 #include "net/base/network_config_watcher_mac.h"
6 6
7 #include <SystemConfiguration/SCDynamicStoreKey.h> 7 #include <SystemConfiguration/SCDynamicStoreKey.h>
8 #include <SystemConfiguration/SCSchemaDefinitions.h> 8 #include <SystemConfiguration/SCSchemaDefinitions.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "base/mac/scoped_cftyperef.h"
12 13
13 // We only post tasks to a child thread we own, so we don't need refcounting. 14 // We only post tasks to a child thread we own, so we don't need refcounting.
14 DISABLE_RUNNABLE_METHOD_REFCOUNT(net::NetworkConfigWatcherMac); 15 DISABLE_RUNNABLE_METHOD_REFCOUNT(net::NetworkConfigWatcherMac);
15 16
16 namespace net { 17 namespace net {
17 18
18 namespace { 19 namespace {
19 20
20 // Called back by OS. Calls OnNetworkConfigChange(). 21 // Called back by OS. Calls OnNetworkConfigChange().
21 void DynamicStoreCallback(SCDynamicStoreRef /* store */, 22 void DynamicStoreCallback(SCDynamicStoreRef /* store */,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DCHECK_EQ(notifier_thread_->message_loop(), MessageLoop::current()); 70 DCHECK_EQ(notifier_thread_->message_loop(), MessageLoop::current());
70 71
71 // Add a run loop source for a dynamic store to the current run loop. 72 // Add a run loop source for a dynamic store to the current run loop.
72 SCDynamicStoreContext context = { 73 SCDynamicStoreContext context = {
73 0, // Version 0. 74 0, // Version 0.
74 delegate_, // User data. 75 delegate_, // User data.
75 NULL, // This is not reference counted. No retain function. 76 NULL, // This is not reference counted. No retain function.
76 NULL, // This is not reference counted. No release function. 77 NULL, // This is not reference counted. No release function.
77 NULL, // No description for this. 78 NULL, // No description for this.
78 }; 79 };
79 scoped_cftyperef<SCDynamicStoreRef> store(SCDynamicStoreCreate( 80 base::mac::ScopedCFTypeRef<SCDynamicStoreRef> store(SCDynamicStoreCreate(
80 NULL, CFSTR("org.chromium"), DynamicStoreCallback, &context)); 81 NULL, CFSTR("org.chromium"), DynamicStoreCallback, &context));
81 run_loop_source_.reset(SCDynamicStoreCreateRunLoopSource( 82 run_loop_source_.reset(SCDynamicStoreCreateRunLoopSource(
82 NULL, store.get(), 0)); 83 NULL, store.get(), 0));
83 CFRunLoopAddSource(CFRunLoopGetCurrent(), run_loop_source_.get(), 84 CFRunLoopAddSource(CFRunLoopGetCurrent(), run_loop_source_.get(),
84 kCFRunLoopCommonModes); 85 kCFRunLoopCommonModes);
85 86
86 // Set up notifications for interface and IP address changes. 87 // Set up notifications for interface and IP address changes.
87 delegate_->SetDynamicStoreNotificationKeys(store.get()); 88 delegate_->SetDynamicStoreNotificationKeys(store.get());
88 89
89 MessageLoop::current()->AddDestructionObserver(this); 90 MessageLoop::current()->AddDestructionObserver(this);
90 } 91 }
91 92
92 } // namespace net 93 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_config_watcher_mac.h ('k') | net/base/platform_mime_util_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698