1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wno-return-type" } */
3
4
5 typedef int size_t;
6 namespace {
7 template < typename > struct char_traits;
8 }
9 namespace __gnu_cxx {
10 template < typename > class new_allocator {
11 };
12 }
13 namespace std {
14 template < typename _Tp > class allocator:__gnu_cxx::new_allocator < _Tp > {
15 public:
16 size_t size_type;
17 typedef _Tp & const_reference;
18 template < typename > struct rebind {
19 typedef allocator other;
20 };
21 };
22 }
23 namespace __gnu_cxx {
24 template < typename _Alloc > struct __alloc_traits {
25 typedef typename _Alloc::const_reference const_reference;
26 template < typename _Tp > struct rebind {
27 typedef typename _Alloc::template rebind < _Tp >::other other;
28 };
29 };
30 }
31 namespace std {
32 struct __numeric_limits_base {
33 };
34 template < typename _Tp > struct numeric_limits:__numeric_limits_base {
maxnumeric_limits35 static _Tp max () {
36 }
37 };
38 template < typename _Tp, typename _Alloc > struct _Vector_base {
39 typedef typename __gnu_cxx::__alloc_traits < _Alloc >::template rebind <
40 _Tp >::other _Tp_alloc_type;
41 };
42 template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:_Vector_base < _Tp,
43 _Alloc
44 > {
45 typedef _Vector_base < _Tp, _Alloc > _Base;
46 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
47 typedef __gnu_cxx::__alloc_traits < _Tp_alloc_type > _Alloc_traits;
48 public:
49 _Tp value_type;
50 typedef typename _Alloc_traits::const_reference const_reference;
51 typedef size_t size_type;
size()52 size_type size () {
53 } const_reference operator[] (size_type) {
54 }
55 };
56 template < typename _CharT, typename =
57 char_traits < _CharT > >class basic_ostream;
58 typedef basic_ostream < int >ostream;
59 class ios_base {
60 };
61 template < typename, typename > class basic_ios:ios_base {
62 };
63 template < typename _CharT, typename _Traits > class basic_ostream:basic_ios < _CharT,
64 _Traits
65 > {
66 public:
67 _CharT char_type;
68 typedef basic_ostream __ostream_type;
69 __ostream_type & operator<< (const void *) {
70 }
71 };
72 }
73 namespace logging {
74 int GetMinLogLevel ();
75 typedef int LogSeverity;
76 LogSeverity LOG_ERROR_REPORT;
77 LogSeverity LOG_DCHECK;
78 class LogMessage {
79 public:
80 LogMessage (const char *, int, LogSeverity);
stream()81 std::ostream & stream () {
82 }
83 };
84 class LogMessageVoidify {
85 public:
LogMessageVoidify()86 LogMessageVoidify () {
87 } void operator& (std::ostream &) {
88 }
89 };
90 }
91 namespace base {
92 namespace internal {
93 class WeakPtrBase {
94 };
95 class SupportsWeakPtrBase {
96 };
97 } template < typename T > class WeakPtr:internal::WeakPtrBase {
98 public:
WeakPtr()99 WeakPtr () :ptr_ () {
100 } T *operator-> () {
101 logging:0 &&
102 logging::LOG_DCHECK >=
103 logging::GetMinLogLevel () ? (void) 0 : logging::
104 LogMessageVoidify () & logging::
105 LogMessage ("../../base/memory/weak_ptr.h", 0,
106 logging::LOG_ERROR_REPORT).stream () << ". ";
107 } T *ptr_;
108 };
109 template < class > class SupportsWeakPtr:internal::SupportsWeakPtrBase {
110 };
111 }
112 template < class ObserverType > class ObserverListBase:base::SupportsWeakPtr < ObserverListBase < ObserverType >
113 > {
114 public:
115 class Iterator {
116 public:
Iterator(ObserverListBase & list)117 Iterator (ObserverListBase & list) :max_index_ (0 ? std::numeric_limits <
118 size_t >::max () : list.observers_.
119 size () ) {
120 } ObserverType *
GetNext()121 GetNext () {
122 ListType & observers = list_->observers_;
123 if (observers[0])
124 ++index_;
125 }
126 base::WeakPtr < ObserverListBase > list_;
127 size_t
128 index_;
129 size_t
130 max_index_;
131 };
132 typedef
133 std::vector <
134 ObserverType * >
135 ListType;
136 ListType
137 observers_;
138 };
139 template < class ObserverType, bool > class ObserverList:public ObserverListBase <
140 ObserverType > {
141 };
142 namespace
143 ProxyPrefs {
144 enum ConfigState
145 { };
146 }
147 namespace
148 net {
149 class
150 ProxyConfig {
151 };
152 class
153 ProxyConfigService {
154 public:
155 enum ConfigAvailability
156 { };
157 class
158 Observer {
159 public:
Observer()160 Observer () {
161 } virtual void
162 OnProxyConfigChanged (const ProxyConfig &, ConfigAvailability) = 0;
163 };
164 virtual void
OnLazyPoll()165 OnLazyPoll () {
166 }
167 };
168 }
169 class
170 ChromeProxyConfigService:
171 net::ProxyConfigService,
172 net::ProxyConfigService::Observer {
173 ConfigAvailability
174 GetLatestProxyConfig (net::ProxyConfig *);
175 void
176 UpdateProxyConfig (ProxyPrefs::ConfigState, const net::ProxyConfig &);
177 void
178 OnProxyConfigChanged (const net::ProxyConfig &, ConfigAvailability);
179 ObserverList <
180 net::ProxyConfigService::Observer,
181 0 >
182 observers_;
183 };
184 void
UpdateProxyConfig(ProxyPrefs::ConfigState,const net::ProxyConfig &)185 ChromeProxyConfigService::UpdateProxyConfig (ProxyPrefs::ConfigState,
186 const net::ProxyConfig &) {
187 net::ProxyConfig new_config;
188 ConfigAvailability availability = GetLatestProxyConfig (0);
189 net:
190 ProxyConfigService::Observer * obs;
191 obs->OnProxyConfigChanged (new_config, availability);
192 }
193 void
OnProxyConfigChanged(const net::ProxyConfig &,ConfigAvailability availability)194 ChromeProxyConfigService::OnProxyConfigChanged (const net::ProxyConfig &,
195 ConfigAvailability
196 availability) {
197 net::ProxyConfig actual_config;
198 ObserverListBase <
199 net::ProxyConfigService::Observer >::Iterator it (observers_);
200 net:
201 ProxyConfigService::Observer * obs;
202 if (it.GetNext () )
203 obs->OnProxyConfigChanged (actual_config, availability);
204 }
205