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

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed)

Created:
10 years, 6 months ago by Peter Kasting
Modified:
9 years, 7 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, dpranke+watch_chromium.org, ben+cc_chromium.org, John Grabowski, amit, idana, brettw-cc_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr., pam+watch_chromium.org, tim (not reviewing), sanjeevr
Visibility:
Public.

Description

Massively simplify the NetworkChangeNotifier infrastructure: * Use a process-wide object (singleton pattern) * Create/destroy this object on the main thread, make it outlive all consumers * Make observer-related functions threadsafe As a result, the notifier can now be used by any thread (eliminating things like NetworkChangeObserverProxy and NetworkChangeNotifierProxy, and expanding its usefulness); its creation and inner workings are much simplified (eliminating implementation-specific classes); and it is simpler to access (eliminating things like NetworkChangeNotifierThread and a LOT of passing pointers around). BUG=none TEST=Unittests; network changes still trigger notifications Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=50895

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 59

Patch Set 3 : '' #

Total comments: 33

Patch Set 4 : '' #

Total comments: 18

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 12

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+613 lines, -2822 lines) Patch
M base/observer_list_threadsafe.h View 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_main.cc View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/io_thread.h View 1 2 3 4 5 6 2 chunks +0 lines, -2 lines 0 comments Download
M chrome/browser/io_thread.cc View 1 2 3 4 5 6 2 chunks +3 lines, -9 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.cc View 1 2 3 4 5 6 6 chunks +10 lines, -17 lines 0 comments Download
M chrome/browser/net/connection_tester.cc View 1 2 3 4 5 6 3 chunks +8 lines, -14 lines 0 comments Download
M chrome/browser/net/resolve_proxy_msg_helper_unittest.cc View 1 2 3 4 5 6 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/profile.h View 1 2 3 4 5 6 2 chunks +0 lines, -7 lines 0 comments Download
M chrome/browser/profile.cc View 1 2 3 4 5 6 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/sync/engine/syncapi.h View 1 2 3 4 5 6 4 chunks +1 line, -10 lines 0 comments Download
M chrome/browser/sync/engine/syncapi.cc View 1 2 3 4 5 6 9 chunks +12 lines, -34 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.h View 1 2 3 4 5 6 9 chunks +4 lines, -24 lines 0 comments Download
M chrome/browser/sync/glue/sync_backend_host.cc View 1 2 3 4 5 6 4 chunks +1 line, -5 lines 0 comments Download
D chrome/browser/sync/net/network_change_notifier_io_thread.h View 1 2 3 4 5 6 1 chunk +0 lines, -38 lines 0 comments Download
D chrome/browser/sync/net/network_change_notifier_io_thread.cc View 1 2 3 4 5 6 1 chunk +0 lines, -24 lines 0 comments Download
D chrome/browser/sync/net/network_change_notifier_io_thread_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -80 lines 0 comments Download
MM chrome/browser/sync/notifier/server_notifier_thread.h View 3 4 5 6 2 chunks +1 line, -7 lines 0 comments Download
MM chrome/browser/sync/notifier/server_notifier_thread.cc View 3 4 5 6 1 chunk +1 line, -4 lines 0 comments Download
M chrome/browser/sync/profile_sync_factory_impl.h View 1 2 3 4 5 6 2 chunks +1 line, -11 lines 0 comments Download
M chrome/browser/sync/profile_sync_factory_impl.cc View 1 2 3 4 5 6 1 chunk +4 lines, -12 lines 0 comments Download
M chrome/browser/sync/profile_sync_factory_impl_unittest.cc View 1 2 3 4 5 6 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.h View 1 2 3 4 5 6 4 chunks +1 line, -10 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.cc View 1 2 3 4 5 6 5 chunks +4 lines, -11 lines 0 comments Download
M chrome/browser/sync/sync_setup_wizard_unittest.cc View 1 2 3 4 5 6 4 chunks +2 lines, -8 lines 0 comments Download
M chrome/browser/sync/test_profile_sync_service.h View 1 2 3 4 5 6 3 chunks +4 lines, -19 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 5 6 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/chrome_common.gypi View 1 2 3 4 5 6 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 chunks +0 lines, -58 lines 0 comments Download
D chrome/common/net/fake_network_change_notifier_thread.h View 1 2 3 4 5 6 1 chunk +0 lines, -67 lines 0 comments Download
D chrome/common/net/fake_network_change_notifier_thread.cc View 1 2 3 4 5 6 1 chunk +0 lines, -77 lines 0 comments Download
D chrome/common/net/fake_network_change_notifier_thread_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -164 lines 0 comments Download
D chrome/common/net/mock_network_change_observer.h View 1 2 3 4 5 6 1 chunk +0 lines, -32 lines 0 comments Download
D chrome/common/net/network_change_notifier_proxy.h View 1 2 3 4 5 6 1 chunk +0 lines, -70 lines 0 comments Download
D chrome/common/net/network_change_notifier_proxy.cc View 1 2 3 4 5 6 1 chunk +0 lines, -55 lines 0 comments Download
D chrome/common/net/network_change_notifier_proxy_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -101 lines 0 comments Download
D chrome/common/net/network_change_notifier_thread.h View 1 2 3 4 5 6 1 chunk +0 lines, -37 lines 0 comments Download
D chrome/common/net/network_change_observer_proxy.h View 1 2 3 4 5 6 1 chunk +0 lines, -114 lines 0 comments Download
D chrome/common/net/network_change_observer_proxy.cc View 1 2 3 4 5 6 1 chunk +0 lines, -137 lines 0 comments Download
D chrome/common/net/network_change_observer_proxy_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -230 lines 0 comments Download
M chrome/common/net/notifier/communicator/login.h View 1 2 3 4 5 6 3 chunks +1 line, -3 lines 0 comments Download
M chrome/common/net/notifier/communicator/login.cc View 1 2 3 4 5 6 6 chunks +3 lines, -7 lines 0 comments Download
M chrome/common/net/notifier/listener/mediator_thread_impl.h View 1 2 3 4 5 6 4 chunks +2 lines, -12 lines 0 comments Download
M chrome/common/net/notifier/listener/mediator_thread_impl.cc View 1 2 3 4 5 6 7 chunks +3 lines, -15 lines 0 comments Download
M chrome/common/net/notifier/listener/talk_mediator_unittest.cc View 1 2 3 4 5 6 4 chunks +3 lines, -7 lines 0 comments Download
D chrome/common/net/thread_blocker.h View 1 2 3 4 5 6 1 chunk +0 lines, -51 lines 0 comments Download
D chrome/common/net/thread_blocker.cc View 1 2 3 4 5 6 1 chunk +0 lines, -47 lines 0 comments Download
D chrome/common/net/thread_blocker_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -109 lines 0 comments Download
M chrome/service/cloud_print/cloud_print_proxy_backend.cc View 1 2 3 4 5 6 2 chunks +2 lines, -4 lines 0 comments Download
D chrome/service/net/service_network_change_notifier_thread.h View 1 2 3 4 5 6 1 chunk +0 lines, -50 lines 0 comments Download
D chrome/service/net/service_network_change_notifier_thread.cc View 1 2 3 4 5 6 1 chunk +0 lines, -46 lines 0 comments Download
D chrome/service/net/service_network_change_notifier_thread_unittest.cc View 1 2 3 4 5 6 1 chunk +0 lines, -100 lines 0 comments Download
M chrome/service/net/service_url_request_context.cc View 1 2 3 4 5 6 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/service/service_process.h View 1 2 3 4 5 6 2 chunks +4 lines, -6 lines 0 comments Download
M chrome/service/service_process.cc View 1 2 3 4 5 6 3 chunks +5 lines, -5 lines 0 comments Download
M chrome_frame/test/test_server_test.cc View 1 2 3 4 5 6 1 chunk +5 lines, -10 lines 0 comments Download
M net/base/host_resolver.h View 1 2 3 4 5 6 2 chunks +1 line, -5 lines 0 comments Download
M net/base/host_resolver_impl.h View 1 2 3 4 5 6 3 chunks +1 line, -6 lines 0 comments Download
M net/base/host_resolver_impl.cc View 1 2 3 4 5 6 6 chunks +5 lines, -11 lines 0 comments Download
M net/base/host_resolver_impl_unittest.cc View 1 2 3 4 5 6 7 11 chunks +15 lines, -28 lines 0 comments Download
M net/base/mock_host_resolver.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
D net/base/mock_network_change_notifier.h View 1 2 3 4 5 6 1 chunk +0 lines, -46 lines 0 comments Download
M net/base/net_test_suite.h View 1 2 3 4 5 6 3 chunks +4 lines, -1 line 0 comments Download
M net/base/network_change_notifier.h View 1 2 3 4 5 6 7 2 chunks +53 lines, -12 lines 2 comments Download
M net/base/network_change_notifier.cc View 1 2 3 4 5 6 7 3 chunks +40 lines, -4 lines 0 comments Download
M net/base/network_change_notifier_linux.h View 1 2 3 4 5 6 2 chunks +21 lines, -33 lines 7 comments Download
M net/base/network_change_notifier_linux.cc View 1 2 3 4 5 6 3 chunks +63 lines, -67 lines 0 comments Download
M net/base/network_change_notifier_mac.h View 1 2 3 4 5 6 1 chunk +27 lines, -29 lines 0 comments Download
M net/base/network_change_notifier_mac.cc View 1 2 3 4 5 6 7 2 chunks +74 lines, -213 lines 0 comments Download
M net/base/network_change_notifier_win.h View 1 2 3 4 5 6 1 chunk +11 lines, -17 lines 0 comments Download
M net/base/network_change_notifier_win.cc View 1 2 3 4 5 6 1 chunk +12 lines, -61 lines 0 comments Download
M net/http/http_cache.h View 1 2 3 4 5 6 2 chunks +2 lines, -3 lines 0 comments Download
M net/http/http_cache.cc View 1 2 3 4 5 6 2 chunks +4 lines, -7 lines 0 comments Download
M net/http/http_network_layer.h View 1 2 3 4 5 6 4 chunks +4 lines, -8 lines 0 comments Download
M net/http/http_network_layer.cc View 1 2 3 4 5 6 6 chunks +3 lines, -12 lines 0 comments Download
M net/http/http_network_layer_unittest.cc View 1 2 3 4 5 6 3 chunks +9 lines, -11 lines 0 comments Download
M net/http/http_network_session.h View 1 2 3 4 5 6 2 chunks +0 lines, -3 lines 0 comments Download
M net/http/http_network_session.cc View 1 2 3 4 5 6 4 chunks +16 lines, -29 lines 0 comments Download
M net/http/http_network_transaction_unittest.cc View 1 2 3 4 5 6 5 chunks +8 lines, -10 lines 0 comments Download
M net/net.gyp View 1 2 3 4 5 6 2 chunks +1 line, -6 lines 0 comments Download
M net/proxy/proxy_script_fetcher_unittest.cc View 1 2 3 4 5 6 1 chunk +5 lines, -7 lines 0 comments Download
M net/proxy/proxy_service.h View 1 2 3 4 5 6 7 chunks +10 lines, -16 lines 0 comments Download
M net/proxy/proxy_service.cc View 1 2 3 4 5 6 8 chunks +8 lines, -21 lines 0 comments Download
M net/proxy/proxy_service_unittest.cc View 1 2 3 4 5 6 7 36 chunks +36 lines, -50 lines 0 comments Download
M net/socket/client_socket_pool_base.h View 1 2 3 4 5 6 4 chunks +4 lines, -9 lines 0 comments Download
M net/socket/client_socket_pool_base.cc View 1 2 3 4 5 6 5 chunks +9 lines, -9 lines 0 comments Download
M net/socket/client_socket_pool_base_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M net/socket/socks_client_socket_pool.h View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M net/socket/socks_client_socket_pool.cc View 1 2 3 4 5 6 1 chunk +2 lines, -3 lines 0 comments Download
M net/socket/socks_client_socket_pool_unittest.cc View 1 2 3 4 5 6 4 chunks +10 lines, -15 lines 0 comments Download
M net/socket/ssl_client_socket_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M net/socket/ssl_test_util.cc View 1 2 3 4 5 6 2 chunks +2 lines, -3 lines 0 comments Download
M net/socket/tcp_client_socket_pool.h View 1 2 3 4 5 6 1 chunk +0 lines, -1 line 0 comments Download
M net/socket/tcp_client_socket_pool.cc View 1 2 3 4 5 6 1 chunk +1 line, -3 lines 0 comments Download
M net/socket/tcp_client_socket_pool_unittest.cc View 1 2 3 4 5 6 7 5 chunks +5 lines, -11 lines 0 comments Download
M net/socket/tcp_client_socket_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M net/socket/tcp_pinger_unittest.cc View 1 2 3 4 5 6 3 chunks +3 lines, -5 lines 0 comments Download
M net/spdy/spdy_http_stream_unittest.cc View 1 2 3 4 5 6 3 chunks +3 lines, -4 lines 0 comments Download
M net/spdy/spdy_network_transaction_unittest.cc View 1 2 3 4 5 6 3 chunks +3 lines, -4 lines 0 comments Download
M net/spdy/spdy_session_pool.h View 1 2 3 4 5 6 5 chunks +3 lines, -6 lines 0 comments Download
M net/spdy/spdy_session_pool.cc View 1 2 3 4 5 6 3 chunks +8 lines, -7 lines 0 comments Download
M net/spdy/spdy_session_unittest.cc View 1 2 3 4 5 6 3 chunks +3 lines, -4 lines 0 comments Download
M net/tools/fetch/fetch_client.cc View 1 2 3 4 5 6 2 chunks +6 lines, -10 lines 0 comments Download
M net/tools/hresolv/hresolv.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M net/url_request/url_request_unittest.h View 1 2 3 4 5 6 2 chunks +10 lines, -11 lines 0 comments Download
M webkit/tools/test_shell/test_shell_request_context.cc View 1 2 3 4 5 6 2 chunks +4 lines, -5 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
Peter Kasting
willchan/eroman: Added both of you as reviewers since I want to make sure I don't ...
10 years, 6 months ago (2010-06-22 22:53:05 UTC) #1
ncarter (slow)
Drive by: this is awesome. http://codereview.chromium.org/2802015/diff/50001/51051 File chrome/service/service_process.cc (right): http://codereview.chromium.org/2802015/diff/50001/51051#newcode39 chrome/service/service_process.cc:39: // The NetworkChanegNotifier must ...
10 years, 6 months ago (2010-06-23 00:29:15 UTC) #2
Peter Kasting
Edit: Added Darin as a reviewer to catch his attention. Darin, could you comment on ...
10 years, 6 months ago (2010-06-23 00:33:13 UTC) #3
darin (slow to review)
On Tue, Jun 22, 2010 at 5:29 PM, <nick@chromium.org> wrote: > Drive by: this is ...
10 years, 6 months ago (2010-06-23 00:55:46 UTC) #4
akalin
http://codereview.chromium.org/2802015/diff/50001/51009 File chrome/browser/sync/engine/syncapi.cc (left): http://codereview.chromium.org/2802015/diff/50001/51009#oldcode1290 chrome/browser/sync/engine/syncapi.cc:1290: talk_mediator_.reset(new TalkMediatorImpl( You'll need to sync and fix the ...
10 years, 6 months ago (2010-06-23 18:46:34 UTC) #5
Peter Kasting
On 2010/06/23 00:55:46, darin wrote: > Unless things have changed, I think we generally use ...
10 years, 6 months ago (2010-06-23 18:49:33 UTC) #6
Peter Kasting
New snap up. http://codereview.chromium.org/2802015/diff/50001/51009 File chrome/browser/sync/engine/syncapi.cc (left): http://codereview.chromium.org/2802015/diff/50001/51009#oldcode1290 chrome/browser/sync/engine/syncapi.cc:1290: talk_mediator_.reset(new TalkMediatorImpl( On 2010/06/23 18:46:34, akalin ...
10 years, 6 months ago (2010-06-23 20:57:19 UTC) #7
eroman
This is a big change, I haven't reviewed all of it yet. Yikes, there was ...
10 years, 6 months ago (2010-06-23 21:20:18 UTC) #8
eroman
http://codereview.chromium.org/2802015/diff/50001/51002 File chrome/browser/io_thread.cc (right): http://codereview.chromium.org/2802015/diff/50001/51002#newcode131 chrome/browser/io_thread.cc:131: net::NetworkChangeNotifier::get()->InitIOThreadFunctionality( On 2010/06/23 21:20:18, eroman wrote: > There introduce ...
10 years, 6 months ago (2010-06-24 00:12:32 UTC) #9
willchan no longer on Chromium
Some preliminary comments. http://codereview.chromium.org/2802015/diff/3003/35006 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/2802015/diff/3003/35006#newcode906 chrome/browser/browser_main.cc:906: scoped_ptr<net::NetworkChangeNotifier> network_change_notifier( On 2010/06/23 21:20:19, eroman ...
10 years, 6 months ago (2010-06-24 00:48:40 UTC) #10
Peter Kasting
New snap up. http://codereview.chromium.org/2802015/diff/50001/51001 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/2802015/diff/50001/51001#newcode1443 chrome/browser/browser_main.cc:1443: network_change_notifier.reset(); On 2010/06/23 21:20:18, eroman wrote: ...
10 years, 6 months ago (2010-06-24 01:42:57 UTC) #11
Peter Kasting
On Wed, Jun 23, 2010 at 6:42 PM, <pkasting@chromium.org> wrote: > A refcounted Core object ...
10 years, 6 months ago (2010-06-24 01:44:34 UTC) #12
eroman
http://codereview.chromium.org/2802015/diff/3003/35069 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/3003/35069#newcode43 net/base/network_change_notifier.h:43: static NetworkChangeNotifier* Create(); On 2010/06/24 01:42:57, Peter Kasting wrote: ...
10 years, 6 months ago (2010-06-24 05:57:54 UTC) #13
Peter Kasting
http://codereview.chromium.org/2802015/diff/3003/35069 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/3003/35069#newcode43 net/base/network_change_notifier.h:43: static NetworkChangeNotifier* Create(); On 2010/06/24 05:57:54, eroman wrote: > ...
10 years, 6 months ago (2010-06-24 07:06:58 UTC) #14
Peter Kasting
Give me a bit before taking another review pass. In addition to addressing eroman's comments, ...
10 years, 6 months ago (2010-06-24 07:27:32 UTC) #15
Peter Kasting
[Due to a 500 error, this got sent by email but not copied onto the ...
10 years, 6 months ago (2010-06-24 21:24:13 UTC) #16
eroman
lgtm http://codereview.chromium.org/2802015/diff/110/67069 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/110/67069#newcode41 net/base/network_change_notifier.h:41: // outlive all other threads which might try ...
10 years, 6 months ago (2010-06-24 22:21:43 UTC) #17
Peter Kasting
http://codereview.chromium.org/2802015/diff/110/67069 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/110/67069#newcode41 net/base/network_change_notifier.h:41: // outlive all other threads which might try to ...
10 years, 6 months ago (2010-06-24 23:59:22 UTC) #18
eroman
lgtm http://codereview.chromium.org/2802015/diff/19018/66075 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/19018/66075#newcode11 net/base/network_change_notifier.h:11: class MessageLoop; Delete.
10 years, 6 months ago (2010-06-25 00:29:58 UTC) #19
Peter Kasting
http://codereview.chromium.org/2802015/diff/19018/66075 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/19018/66075#newcode11 net/base/network_change_notifier.h:11: class MessageLoop; On 2010/06/25 00:29:58, eroman wrote: > Delete. ...
10 years, 6 months ago (2010-06-25 01:04:33 UTC) #20
willchan no longer on Chromium
I'm sorry I took so long to get to this. I haven't reviewed all the ...
10 years, 6 months ago (2010-06-25 15:36:22 UTC) #21
Peter Kasting
Added Brett as a reviewer to get his attention. Brett, can you comment on the ...
10 years, 6 months ago (2010-06-25 17:51:32 UTC) #22
Peter Kasting
On Fri, Jun 25, 2010 at 11:31 AM, <brettw@chromium.org> wrote: > > http://codereview.chromium.org/2802015/diff/3003/35070 > File ...
10 years, 6 months ago (2010-06-25 18:36:05 UTC) #23
willchan no longer on Chromium
LGTM http://codereview.chromium.org/2802015/diff/3003/35069 File net/base/network_change_notifier.h (right): http://codereview.chromium.org/2802015/diff/3003/35069#newcode43 net/base/network_change_notifier.h:43: static NetworkChangeNotifier* Create(); On 2010/06/25 17:51:33, Peter Kasting ...
10 years, 6 months ago (2010-06-25 19:09:28 UTC) #24
willchan no longer on Chromium
On 2010/06/25 18:36:05, Peter Kasting wrote: > On Fri, Jun 25, 2010 at 11:31 AM, ...
10 years, 6 months ago (2010-06-25 19:21:50 UTC) #25
Peter Kasting
10 years, 6 months ago (2010-06-25 20:01:37 UTC) #26
Thanks for the careful review.  I appreciate the thorough discussion of
dependency injection patterns, it helps me to understand what are the valid
alternative designs and their tradeoffs.

http://codereview.chromium.org/2802015/diff/3003/35069
File net/base/network_change_notifier.h (right):

http://codereview.chromium.org/2802015/diff/3003/35069#newcode43
net/base/network_change_notifier.h:43: static NetworkChangeNotifier* Create();
On 2010/06/25 19:09:28, willchan wrote:
> Combining args into a struct reduces the brittleness though of passing
> dependencies and having to update them in a gazillion places, since once
you're
> passing through the struct, you can add a field and update in one place,
rather
> than all the different layers where you had to previously.  This addresses
part
> of the problem with plumbing data through layers.

Ah, OK.  I had thought I misunderstood you.  You're right, this reduces
maintenance costs and reading burden (though it can cause its own problems later
if some of the involved classes change their required dependencies but others
don't).

I was more worried about layering, in the sense of whether it was appropriate
for class A to "know about" some type or object that class B needed.  There's a
bunch of code in the omnibox that ends up passing objects through several
classes, and it feels gross because it exposes the destination's dependency at
all points along the chain.  Sometimes that's hard to avoid, though.

> > There are a couple downsides.  This means that all objects which can
construct
> > the target class need to know about and access the singleton in question,
> which
> > adds dependencies that to me seem artificial (and certainly increase
> maintenance
> > costs, especially if the singleton's access pattern changes radically).
> 
> This is a fair argument, but unless I'm misunderstanding, it fundamentally
> applies to the dependency injection pattern in general.

Well... it applies when you inject the dependency via arguments at construction
time.  Technically, if the target class gets the service it needs via some
accessor, which test code can override to return a different service
implementation, you still have dependency injection, unless I'm mistaken.  The
injector has to override the accessor functionality as opposed to having to
construct its own instance of the target class.  I tend to prefer this sort of
pattern, but depending on how the target class is constructed, it might be much
harder to implement.

http://codereview.chromium.org/2802015/diff/19018/66077
File net/base/network_change_notifier_linux.h (right):

http://codereview.chromium.org/2802015/diff/19018/66077#newcode49
net/base/network_change_notifier_linux.h:49: scoped_ptr<base::Thread>
notifier_thread_;
On 2010/06/25 19:09:29, willchan wrote:
> You've deleted basictypes.h, which IIRC is required for DISALLOW_*

Oh, oops.  Fixed in all the network_change_notifier*.h files.

Powered by Google App Engine
This is Rietveld 408576698