PSA: libchrome has been updated on Chrome OS

11 views
Skip to first unread message

Alex Vakulenko

unread,
Jan 27, 2016, 11:25:17 AM1/27/16
to chromium-os-dev
Finally a new version of libchrome (r369476) has landed into Chrome OS.

The new library contains the latest fixes/changes from Chromium for the past 6 months or so.

Notable changes include:
  • base::scoped_ptr<T> is now almost identical to std::unique_ptr<T>.  No Pass() method, now std::move() is used on scoped pointers.
  • basictypes.h is removed and custom int types such as int32 are now replaced with the standard int32_t and similar from <stdint.h>
  • COMPILE_ASSERT() is now replaced with standard static_assert()
  • Numeric range constants such as kuint64max are removed in favor of standard <limits> constructs such as std::numeric_limits<uint64_t>::max()
  • base::Value and derived classes use scoped_ptr<> more and support for raw pointers to base::Value is deprecated and/or removed in many places.
  • base::MessageLoopProxy is completely removed (was marked deprecated before)
  • base::MessageLoop::Quit() and QuitClosure are renamed to QuitWhenIdle and QuitWhenIdleClosure for more semantic clarity.
  • base::Bind/base::Callback now natively support move-only types (such as std::unique_ptr).
  • String utility functions are cleaned up/refactored. Now all are in base:: namespace, many now return values rather than take pointers for results, ambiguous Booleans are replaced with enums
To elaborate a bit on the last point, there used to be a number of string splitting functions and overloads, such as SplitString, SplitStringDontTrim, SplitStringAlongWhitespace, Tokenize and so on. They are all replaced with just one function, SplitString with explicit options for split operation passed in as arguments.

Here are a few examples of typical change that needs to happen:

- SplitStringDontTrim("   ", '*', &r);
+ r = SplitString("   ", "*", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL);

- SplitStringAlongWhitespace(data[i].input, &results);
+ results = base::SplitString(data[i].input, base::kWhitespaceASCII, base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);

- SplitString(zone_path_contents, '\n', &lines);
+ lines = SplitString(zone_path_contents, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);

- if (base::EndsWith(dll_name, kDelaySuffix, false)) {
+ if (base::EndsWith(dll_name, kDelaySuffix, base::CompareCase::INSENSITIVE_ASCII)) {

- base::StartsWithASCII(window_class, kChromeWindowClassPrefix, true)
+ base::EndsWith(window_class, kChromeWindowClassPrefix, base::CompareCase::SENSITIVE)

- Tokenize(version, ".", &tokens);
+ tokens = base::SplitString(version, ".", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);

- if (!base::strcasecmp(it->first.c_str(), header)) {
+ if (base::EqualsCaseInsensitiveASCII(it->first, header)) {

All the existing code in Chrome OS has been fixed already. If you have CLs in the works, make sure you rebase them onto ToT and make sure they still compile and work as expected.

If you have any questions or problems, let me know.

Alex
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages