Chromium Code Reviews

Side by Side Diff: net/proxy/proxy_config_service_linux.cc

Issue 214036: Linux: fix a data race in a proxy config service unit test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/proxy/proxy_config_service_linux.h" 5 #include "net/proxy/proxy_config_service_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <gconf/gconf-client.h> 9 #include <gconf/gconf-client.h>
10 #include <limits.h> 10 #include <limits.h>
(...skipping 1023 matching lines...)
1034 // Consulting environment variables doesn't need to be done from 1034 // Consulting environment variables doesn't need to be done from
1035 // the default glib main loop, but it's a tiny enough amount of 1035 // the default glib main loop, but it's a tiny enough amount of
1036 // work. 1036 // work.
1037 if (GetConfigFromEnv(&cached_config_)) { 1037 if (GetConfigFromEnv(&cached_config_)) {
1038 cached_config_.set_id(1); // mark it as valid 1038 cached_config_.set_id(1); // mark it as valid
1039 LOG(INFO) << "Obtained proxy settings from environment variables"; 1039 LOG(INFO) << "Obtained proxy settings from environment variables";
1040 } 1040 }
1041 } 1041 }
1042 } 1042 }
1043 1043
1044 void ProxyConfigServiceLinux::Delegate::Reset() {
1045 DCHECK(!glib_default_loop_ || MessageLoop::current() == glib_default_loop_);
1046 gconf_getter_->Shutdown();
1047 cached_config_ = ProxyConfig();
1048 }
1049
1050 int ProxyConfigServiceLinux::Delegate::GetProxyConfig(ProxyConfig* config) { 1044 int ProxyConfigServiceLinux::Delegate::GetProxyConfig(ProxyConfig* config) {
1051 // This is called from the IO thread. 1045 // This is called from the IO thread.
1052 DCHECK(!io_loop_ || MessageLoop::current() == io_loop_); 1046 DCHECK(!io_loop_ || MessageLoop::current() == io_loop_);
1053 1047
1054 // Simply return the last proxy configuration that glib_default_loop 1048 // Simply return the last proxy configuration that glib_default_loop
1055 // notified us of. 1049 // notified us of.
1056 *config = cached_config_; 1050 *config = cached_config_;
1057 return cached_config_.is_valid() ? OK : ERR_FAILED; 1051 return cached_config_.is_valid() ? OK : ERR_FAILED;
1058 } 1052 }
1059 1053
(...skipping 63 matching lines...)
1123 : delegate_(new Delegate(env_var_getter)) { 1117 : delegate_(new Delegate(env_var_getter)) {
1124 } 1118 }
1125 1119
1126 ProxyConfigServiceLinux::ProxyConfigServiceLinux( 1120 ProxyConfigServiceLinux::ProxyConfigServiceLinux(
1127 base::EnvironmentVariableGetter* env_var_getter, 1121 base::EnvironmentVariableGetter* env_var_getter,
1128 GConfSettingGetter* gconf_getter) 1122 GConfSettingGetter* gconf_getter)
1129 : delegate_(new Delegate(env_var_getter, gconf_getter)) { 1123 : delegate_(new Delegate(env_var_getter, gconf_getter)) {
1130 } 1124 }
1131 1125
1132 } // namespace net 1126 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_config_service_linux.h ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine