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

Issue 7714004: base: Add AsList() function to Value API. (Closed)

Created:
9 years, 4 months ago by tfarina
Modified:
9 years, 4 months ago
Reviewers:
tony, kkania, Evan Martin
CC:
chromium-reviews, Erik does not do reviews, brettw-cc_chromium.org, mihaip+watch_chromium.org, Aaron Boodman, darin-cc_chromium.org, Paweł Hajdan Jr., davemoore+watch_chromium.org
Visibility:
Public.

Description

base: Add AsList() function to Value API. This function should simplify some constructions. Instead of: if (!value->IsType(Value::TYPE_LIST)) return false; ListValue* list_value = static_cast<ListValue*>(value); You can do: ListValue* list_value = value->AsList(); if (!list_value) return false; BUG=None TEST=base_unittests --gtest_filter=Values* R=evan@chromium.org,tony@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98223

Patch Set 1 #

Patch Set 2 : now using virtual functions #

Patch Set 3 : more changes #

Patch Set 4 : OVERRIDE #

Total comments: 8

Patch Set 5 : evan review #

Patch Set 6 : convert one more case in extension_webrequest_api_unittest.cc #

Total comments: 14

Patch Set 7 : more review #

Patch Set 8 : fix test_support_common #

Patch Set 9 : more poor const_casts #

Total comments: 2

Patch Set 10 : fix the problem with webdriver_dispatch.cc #

Patch Set 11 : fix chromeos #

Unified diffs Side-by-side diffs Delta from patch set Stats (+225 lines, -204 lines) Patch
M base/json/json_reader_unittest.cc View 1 2 3 4 4 chunks +10 lines, -10 lines 0 comments Download
M base/values.h View 1 2 3 4 5 6 7 8 9 2 chunks +3 lines, -0 lines 0 comments Download
M base/values.cc View 1 2 3 4 5 6 7 8 9 5 chunks +11 lines, -3 lines 0 comments Download
M base/values_unittest.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/autocomplete/search_provider.cc View 1 2 3 4 2 chunks +5 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/cros/native_network_parser.h View 1 2 3 4 5 6 7 8 9 10 9 chunks +24 lines, -14 lines 0 comments Download
M chrome/browser/chromeos/cros/native_network_parser.cc View 1 2 3 4 5 6 7 8 9 10 24 chunks +77 lines, -80 lines 0 comments Download
M chrome/browser/chromeos/cros/network_library.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/cros/network_library.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +16 lines, -11 lines 0 comments Download
M chrome/browser/chromeos/cros/network_parser.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/chromeos/cros/network_parser.cc View 1 2 3 4 5 6 7 8 9 10 13 chunks +19 lines, -19 lines 0 comments Download
M chrome/browser/extensions/extension_bookmarks_module.cc View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/extension_webrequest_api_unittest.cc View 1 2 3 4 5 1 chunk +4 lines, -5 lines 0 comments Download
M chrome/common/json_value_serializer_unittest.cc View 1 2 3 4 2 chunks +6 lines, -4 lines 0 comments Download
M chrome/renderer/extensions/extension_process_bindings.cc View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/test/automation/automation_json_requests.cc View 1 2 3 4 5 6 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/test/automation/javascript_execution_controller.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/test/automation/javascript_message_utils.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/test/automation/tab_proxy.cc View 1 2 3 4 5 6 3 chunks +6 lines, -6 lines 0 comments Download
M chrome/test/automation/value_conversion_traits.cc View 1 2 3 4 5 6 7 1 chunk +4 lines, -3 lines 0 comments Download
M chrome/test/base/ui_test_utils.cc View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -4 lines 0 comments Download
M chrome/test/perf/dom_checker_uitest.cc View 1 chunk +3 lines, -4 lines 0 comments Download
M chrome/test/webdriver/commands/response.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/webdriver/commands/response.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/webdriver/webdriver_dispatch.cc View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -5 lines 0 comments Download
M chrome/test/webdriver/webdriver_session.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
content/browser/speech/speech_recognition_request.cc View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M content/renderer/web_ui_bindings.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 9 (0 generated)
tfarina
9 years, 4 months ago (2011-08-23 18:05:25 UTC) #1
Evan Martin
only looked at the first half http://codereview.chromium.org/7714004/diff/5001/chrome/browser/autocomplete/search_provider.cc File chrome/browser/autocomplete/search_provider.cc (right): http://codereview.chromium.org/7714004/diff/5001/chrome/browser/autocomplete/search_provider.cc#newcode473 chrome/browser/autocomplete/search_provider.cc:473: description_list = static_cast<ListValue*>(description_val); ...
9 years, 4 months ago (2011-08-23 18:15:25 UTC) #2
tfarina
Thanks for the feedback Evan! Fixed the first half reviewed! Thanks for spotting and suggesting ...
9 years, 4 months ago (2011-08-23 18:26:36 UTC) #3
Evan Martin
http://codereview.chromium.org/7714004/diff/4025/chrome/browser/extensions/extension_bookmarks_module.cc File chrome/browser/extensions/extension_bookmarks_module.cc (right): http://codereview.chromium.org/7714004/diff/4025/chrome/browser/extensions/extension_bookmarks_module.cc#newcode289 chrome/browser/extensions/extension_bookmarks_module.cc:289: const ListValue* ids = static_cast<const ListValue*>(arg0); if (ListValue ids ...
9 years, 4 months ago (2011-08-23 19:04:07 UTC) #4
tfarina
http://codereview.chromium.org/7714004/diff/4025/chrome/browser/extensions/extension_bookmarks_module.cc File chrome/browser/extensions/extension_bookmarks_module.cc (right): http://codereview.chromium.org/7714004/diff/4025/chrome/browser/extensions/extension_bookmarks_module.cc#newcode289 chrome/browser/extensions/extension_bookmarks_module.cc:289: const ListValue* ids = static_cast<const ListValue*>(arg0); On 2011/08/23 19:04:11, ...
9 years, 4 months ago (2011-08-23 20:00:33 UTC) #5
tony
LGTM. You need evan to LG for OWNERS. http://codereview.chromium.org/7714004/diff/2017/chrome/test/webdriver/webdriver_dispatch.cc File chrome/test/webdriver/webdriver_dispatch.cc (right): http://codereview.chromium.org/7714004/diff/2017/chrome/test/webdriver/webdriver_dispatch.cc#newcode177 chrome/test/webdriver/webdriver_dispatch.cc:177: ListValue* ...
9 years, 4 months ago (2011-08-24 19:37:51 UTC) #6
Evan Martin
owners LGTM
9 years, 4 months ago (2011-08-24 20:06:09 UTC) #7
tfarina
http://codereview.chromium.org/7714004/diff/2017/chrome/test/webdriver/webdriver_dispatch.cc File chrome/test/webdriver/webdriver_dispatch.cc (right): http://codereview.chromium.org/7714004/diff/2017/chrome/test/webdriver/webdriver_dispatch.cc#newcode177 chrome/test/webdriver/webdriver_dispatch.cc:177: ListValue* list_value = const_cast<Value*>(value)->AsList(); On 2011/08/24 19:37:51, tony wrote: ...
9 years, 4 months ago (2011-08-24 20:46:51 UTC) #8
kkania
9 years, 4 months ago (2011-08-26 00:43:37 UTC) #9
This change has a small bug in
chrome/test/automation/automation_json_requests.cc:302. You need to release the
value*. I see this CL is being reverted for other reasons
(http://codereview.chromium.org/7753020/). If you reland, please fix first.

Powered by Google App Engine
This is Rietveld 408576698