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

Issue 7661009: base: Add Is* functions to Value class. (Closed)

Created:
9 years, 4 months ago by tfarina
Modified:
9 years, 4 months ago
Reviewers:
tony, Evan Martin
CC:
chromium-reviews, jam, mihaip+watch_chromium.org, stuartmorgan+watch_chromium.org, ajwong+watch_chromium.org, ncarter (slow), idana, Erik does not do reviews, dmaclach+watch_chromium.org, apatrick_chromium, joi+watch-content_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, tim (not reviewing), rharrison, kkania, wez+watch_chromium.org, Raghu Simha, cbentzel+watch_chromium.org, simonmorris+watch_chromium.org, sergeyu+watch_chromium.org, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, garykac+watch_chromium.org, Aaron Boodman, lambroslambrou+watch_chromium.org, Paweł Hajdan Jr., estade+watch_chromium.org, davemoore+watch_chromium.org
Visibility:
Public.

Description

base: Add Is* functions to Value class. This will simplify a lot the code in the clients of the Values API. This replaces all the uses of IsType(Value::TYPE_*); The clients now are be able to say (in a nice way), for example: value->IsNull(); Instead of: value->IsType(Value::TYPE_NULL); or value->GetType() == Value::TYPE_NULL BUG=None TEST=None R=evan@chromium.org,tony@chromium.org

Patch Set 1 #

Patch Set 2 : save lines #

Patch Set 3 : fixes #

Patch Set 4 : rebased #

Patch Set 5 : fix nat_policy.cc #

Total comments: 4

Patch Set 6 : tony review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+265 lines, -246 lines) Patch
M base/json/json_reader_unittest.cc View 20 chunks +33 lines, -33 lines 0 comments Download
M base/values.h View 1 chunk +8 lines, -2 lines 0 comments Download
M base/values.cc View 1 2 3 12 chunks +51 lines, -19 lines 0 comments Download
M base/values_unittest.cc View 8 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/autocomplete/search_provider.cc View 1 5 chunks +6 lines, -9 lines 0 comments Download
M chrome/browser/chromeos/cros/native_network_parser.cc View 8 chunks +10 lines, -10 lines 0 comments Download
M chrome/browser/component_updater/component_unpacker.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/debugger_remote_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/devtools_remote_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/debugger/extension_ports_remote_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/execute_code_in_tab_function.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_bookmarks_module.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_cookies_api.cc View 1 chunk +1 line, -1 line 0 comments Download
chrome/browser/extensions/extension_debugger_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_function.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_management_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_proxy_api.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_service_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_settings_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_webrequest_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_webrequest_api_unittest.cc View 1 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/extension_webstore_private_api.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/external_pref_extension_loader.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/history/top_sites.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/metrics/metrics_log.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/metrics/metrics_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/plugin_prefs.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/policy/config_dir_policy_provider.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/policy/configuration_policy_pref_store.cc View 1 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/policy/configuration_policy_provider.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/policy/configuration_policy_provider_mac_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/policy/configuration_policy_provider_win_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_model_associator.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_service.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_service_uitest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/prefs/pref_value_store.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/printing/print_dialog_cloud.cc View 1 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/sync/syncable/model_type.cc View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/themes/browser_theme_pack_unittest.cc View 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/translate/translate_manager.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/login/login_prompt_ui.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/select_file_dialog.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/chromeos/login/enterprise_enrollment_screen_handler.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/ntp/most_visited_handler.cc View 1 chunk +1 line, -1 line 0 comments Download
chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc View 1 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/ui/webui/options/core_options_handler.cc View 1 4 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/print_preview_handler.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/sync_setup_handler.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/web_resource/promo_resource_service.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/common/extensions/extension.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/extension_file_util.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/extension_unpacker.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/json_pref_store.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/json_schema_validator.cc View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/json_schema_validator_unittest_base.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/json_value_serializer_unittest.cc View 4 chunks +6 lines, -6 lines 0 comments Download
M chrome/common/net/gaia/gaia_oauth_client.cc View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M chrome/common/web_apps.cc View 1 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/common/web_resource/web_resource_unpacker.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/installer/util/google_chrome_distribution.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/installer/util/master_preferences.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/extensions/extension_api_json_validity_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/service/cloud_print/cloud_print_helpers.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/service/cloud_print/print_system_cups.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/service/service_process_prefs.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/automation/automation_json_requests.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/test/automation/javascript_execution_controller.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/test/automation/javascript_message_utils.h View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/automation/tab_proxy.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/test/automation/value_conversion_traits.cc View 1 2 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/test/base/ui_test_utils.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/test/perf/dom_checker_uitest.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/test/ui/javascript_test_util.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/test/webdriver/commands/command.cc View 1 2 3 4 5 1 chunk +1 line, -3 lines 0 comments Download
M chrome/test/webdriver/commands/set_timeout_commands_unittest.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/webdriver/commands/webelement_commands.cc View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/test/webdriver/webdriver_basic_types.cc View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/test/webdriver/webdriver_dispatch.cc View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/test/webdriver/webdriver_dispatch_unittest.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/webdriver/webdriver_element_id.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/webdriver/webdriver_session.cc View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M content/browser/debugger/devtools_netlog_observer.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/geolocation/network_location_request.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M content/browser/gpu/gpu_blacklist.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/speech/speech_recognition_request.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M content/renderer/web_ui_bindings.cc View 1 chunk +1 line, -1 line 0 comments Download
M jingle/glue/utils.cc View 1 chunk +1 line, -2 lines 0 comments Download
M net/base/crl_filter.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M net/base/transport_security_state.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M net/test/test_server.cc View 1 chunk +1 line, -2 lines 0 comments Download
M remoting/client/plugin/chromoting_instance.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M remoting/host/json_host_config.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M remoting/host/plugin/policy_hack/nat_policy.cc View 1 2 3 4 1 chunk +1 line, -3 lines 0 comments Download
M remoting/host/plugin/policy_hack/nat_policy_linux.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 12 (0 generated)
tfarina
9 years, 4 months ago (2011-08-17 01:17:31 UTC) #1
tfarina
+tony for review. Hi Tony, could you review this to me?
9 years, 4 months ago (2011-08-19 14:36:46 UTC) #2
Evan Martin
On 2011/08/19 14:36:46, tfarina wrote: > +tony for review. > > Hi Tony, could you ...
9 years, 4 months ago (2011-08-19 17:22:23 UTC) #3
tony
I like this change-- seems to be easier to read than IsType(). http://codereview.chromium.org/7661009/diff/4012/chrome/test/webdriver/commands/command.cc File chrome/test/webdriver/commands/command.cc ...
9 years, 4 months ago (2011-08-19 17:24:20 UTC) #4
tony
Sorry, didn't see Evan's comment before I replied. I agree with Evan, but it could ...
9 years, 4 months ago (2011-08-19 17:26:15 UTC) #5
Evan Martin
AsFoo() returns non-zero only for Foos, so it can also be used in place of ...
9 years, 4 months ago (2011-08-19 17:30:36 UTC) #6
tony
Ah, I see. You're right, we wouldn't need the Is*() methods. Yeah, that sounds better. ...
9 years, 4 months ago (2011-08-19 17:33:38 UTC) #7
tfarina
http://codereview.chromium.org/7661009/diff/4012/chrome/test/webdriver/commands/command.cc File chrome/test/webdriver/commands/command.cc (right): http://codereview.chromium.org/7661009/diff/4012/chrome/test/webdriver/commands/command.cc#newcode44 chrome/test/webdriver/commands/command.cc:44: value->IsNull(); On 2011/08/19 17:24:21, tony wrote: > Nit: Maybe ...
9 years, 4 months ago (2011-08-19 18:40:47 UTC) #8
tfarina
On 2011/08/19 17:22:23, Evan Martin wrote: > On 2011/08/19 14:36:46, tfarina wrote: > > +tony ...
9 years, 4 months ago (2011-08-19 19:59:50 UTC) #9
tfarina
Tony, Evan, can I go with the current route?
9 years, 4 months ago (2011-08-22 19:13:22 UTC) #10
tony
I think we should do evan's recommendation (the As* functions). If you are worried about ...
9 years, 4 months ago (2011-08-23 17:21:41 UTC) #11
tfarina
9 years, 4 months ago (2011-08-23 17:45:36 UTC) #12
On 2011/08/23 17:21:41, tony wrote:
> I think we should do evan's recommendation (the As* functions).  If you are
> worried about the change being too big, you can convert one type at a time
> (separate patches for AsBool, AsString, etc).
Yeah, I'm worried about that. It's very big to do everything at once. I've
started the AsList() and pushed it here http://codereview.chromium.org/7714004/.

Powered by Google App Engine
This is Rietveld 408576698