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

Issue 7453051: This factors out all of the parsing code from the network library (Closed)

Created:
9 years, 4 months ago by Greg Spencer (Chromium)
Modified:
9 years, 4 months ago
Reviewers:
stevenjb
CC:
chromium-reviews, kkania, davemoore+watch_chromium.org, Paweł Hajdan Jr., Charlie Lee
Visibility:
Public.

Description

This factors out all of the parsing code from the network library network classes into a separate hierarchy of parsers. This is in preparation for creating a second parser hierarchy that can be used to create networks from a configuration file instead of from flimflam. In the course of doing this, I updated much of the style inconsistencies in this code (mainly having to do with passing arguments). BUG=chromium-os:15457 TEST=ran on device, connected to new network, forgot a network. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96794

Patch Set 1 : Finally working #

Total comments: 46

Patch Set 2 : Remove unused function #

Patch Set 3 : Review changes #

Patch Set 4 : Removing some unneeded stuff #

Patch Set 5 : Fixing variable names to have consistent caps #

Total comments: 6

Patch Set 6 : Reducing friends to minimal set. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2975 lines, -1602 lines) Patch
M chrome/browser/automation/testing_automation_provider_chromeos.cc View 4 chunks +7 lines, -7 lines 0 comments Download
A chrome/browser/chromeos/cros/native_network_constants.h View 1 2 3 4 1 chunk +277 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/cros/native_network_constants.cc View 1 2 3 4 1 chunk +321 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/cros/native_network_parser.h View 1 2 1 chunk +141 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/cros/native_network_parser.cc View 1 2 3 4 1 chunk +1158 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/cros/network_library.h View 1 2 3 4 5 22 chunks +443 lines, -120 lines 0 comments Download
M chrome/browser/chromeos/cros/network_library.cc View 1 2 3 4 57 chunks +167 lines, -1446 lines 0 comments Download
A chrome/browser/chromeos/cros/network_parser.h View 1 2 1 chunk +154 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/cros/network_parser.cc View 1 2 1 chunk +272 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/options/vpn_config_view.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/options/vpn_config_view.cc View 11 chunks +25 lines, -25 lines 0 comments Download
M chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Greg Spencer (Chromium)
Steven, Here's that enormous yak-shaving CL I warned you about. Charlie, I've CC'd you on ...
9 years, 4 months ago (2011-08-04 23:02:14 UTC) #1
stevenjb
http://codereview.chromium.org/7453051/diff/2001/chrome/browser/chromeos/cros/native_network_constants.h File chrome/browser/chromeos/cros/native_network_constants.h (right): http://codereview.chromium.org/7453051/diff/2001/chrome/browser/chromeos/cros/native_network_constants.h#newcode11 chrome/browser/chromeos/cros/native_network_constants.h:11: #include "chrome/browser/chromeos/cros/network_library.h" We should forward declare ConnectionType, etc, instead ...
9 years, 4 months ago (2011-08-05 18:46:58 UTC) #2
Greg Spencer (Chromium)
http://codereview.chromium.org/7453051/diff/2001/chrome/browser/chromeos/cros/native_network_constants.h File chrome/browser/chromeos/cros/native_network_constants.h (right): http://codereview.chromium.org/7453051/diff/2001/chrome/browser/chromeos/cros/native_network_constants.h#newcode11 chrome/browser/chromeos/cros/native_network_constants.h:11: #include "chrome/browser/chromeos/cros/network_library.h" On 2011/08/05 18:46:58, Steven Bennetts wrote: > ...
9 years, 4 months ago (2011-08-11 22:19:31 UTC) #3
stevenjb
I'd like to do a pass to see how many explicit friendships we can avoid, ...
9 years, 4 months ago (2011-08-12 21:32:37 UTC) #4
Greg Spencer (Chromium)
http://codereview.chromium.org/7453051/diff/13002/chrome/browser/chromeos/cros/network_library.h File chrome/browser/chromeos/cros/network_library.h (right): http://codereview.chromium.org/7453051/diff/13002/chrome/browser/chromeos/cros/network_library.h#newcode449 chrome/browser/chromeos/cros/network_library.h:449: friend class NativeVirtualNetworkParser; On 2011/08/12 21:32:37, Steven Bennetts wrote: ...
9 years, 4 months ago (2011-08-12 23:45:19 UTC) #5
stevenjb
9 years, 4 months ago (2011-08-13 00:01:45 UTC) #6
LEBTM (looks even better to me)
LGTM (for the bots)

http://codereview.chromium.org/7453051/diff/13002/chrome/browser/chromeos/cro...
File chrome/browser/chromeos/cros/network_library.h (right):

http://codereview.chromium.org/7453051/diff/13002/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros/network_library.h:449: friend class
NativeVirtualNetworkParser;
On 2011/08/12 23:45:19, Greg Spencer (Chromium) wrote:
> On 2011/08/12 21:32:37, Steven Bennetts wrote:
> > I am curious why network parsers are modifying NetworkDevice, or accessing
> > private data? It seems like we should change the interface rather than
having
> so
> > many friends.
> 
> OK, turns out they're not.  I've fixed all of these classes to just use the
> minimal set of friends required, and in most cases it's just one or two.

Awesome, this looks much better to me.

http://codereview.chromium.org/7453051/diff/13002/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros/network_library.h:707: friend class
NativeVirtualNetworkParser;
On 2011/08/12 23:45:19, Greg Spencer (Chromium) wrote:
> On 2011/08/12 21:32:37, Steven Bennetts wrote:
> > In theory, it seems like only NativeNetworkParser() should need to be a
> friend,
> > and anything that modifies a shared parameter should be in the base class. I
> > realize that may not be pragmatic however.
> 
> I tried that approach, and it leads to a lot of protected functions in the
base
> class that look like:
> 
> static void set_network_name(Network* network, const std::string& name) {
> network->set_name(name); }
> 
> and the call sites aren't as simple either, instead of:
> 
> network->set_name(name);
> 
> you get:
> 
> NativeNetworkParser::set_network_name(network, name);
> 
> It's not horrible, but it also meant that for every attribute added to the
> network class, you have to go out to all to any parser that needs to set it
and
> add a function like this, so I opted for something more centralized: all the
> accessors are next to the variables they set in the network class.
> 
> This way, you *could* set the private var directly, but using the private
setter
> gets you most of the benefits of having a more public setter, while
restricting
> use to classes that need it, and still you have the independence of changing
the
> representation of the private var without changing all the call sites if
needed.
> 
> I could certainly be convinced that another method was better, but at this
point
> I've tried making all the setters public (with no friends needed), making the
> subclasses all go through the base class, and just making the subclasses
friends
> where necessary, and the last one appears to be the best, so that's why I
picked
> it.

This is fine I think now that we are down to a more minimal set.

Powered by Google App Engine
This is Rietveld 408576698