AAPT2: Rename to match new style

Use Google3 naming style to match new
projects' and open source google projects' style.

Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.

Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
diff --git a/tools/aapt2/proto/TableProtoSerializer.cpp b/tools/aapt2/proto/TableProtoSerializer.cpp
index a5c2cbc..68db6b3 100644
--- a/tools/aapt2/proto/TableProtoSerializer.cpp
+++ b/tools/aapt2/proto/TableProtoSerializer.cpp
@@ -22,6 +22,8 @@
 #include "proto/ProtoSerialize.h"
 #include "util/BigBuffer.h"
 
+#include <android-base/logging.h>
+
 using google::protobuf::io::CodedOutputStream;
 using google::protobuf::io::CodedInputStream;
 using google::protobuf::io::ZeroCopyOutputStream;
@@ -31,179 +33,185 @@
 namespace {
 
 class PbSerializerVisitor : public RawValueVisitor {
-public:
-    using RawValueVisitor::visit;
+ public:
+  using RawValueVisitor::Visit;
 
-    /**
-     * Constructor to use when expecting to serialize any value.
-     */
-    PbSerializerVisitor(StringPool* sourcePool, StringPool* symbolPool, pb::Value* outPbValue) :
-            mSourcePool(sourcePool), mSymbolPool(symbolPool), mOutPbValue(outPbValue),
-            mOutPbItem(nullptr) {
+  /**
+   * Constructor to use when expecting to serialize any value.
+   */
+  PbSerializerVisitor(StringPool* source_pool, StringPool* symbol_pool,
+                      pb::Value* out_pb_value)
+      : source_pool_(source_pool),
+        symbol_pool_(symbol_pool),
+        out_pb_value_(out_pb_value),
+        out_pb_item_(nullptr) {}
+
+  /**
+   * Constructor to use when expecting to serialize an Item.
+   */
+  PbSerializerVisitor(StringPool* sourcePool, StringPool* symbolPool,
+                      pb::Item* outPbItem)
+      : source_pool_(sourcePool),
+        symbol_pool_(symbolPool),
+        out_pb_value_(nullptr),
+        out_pb_item_(outPbItem) {}
+
+  void Visit(Reference* ref) override {
+    SerializeReferenceToPb(*ref, pb_item()->mutable_ref());
+  }
+
+  void Visit(String* str) override {
+    pb_item()->mutable_str()->set_idx(str->value.index());
+  }
+
+  void Visit(StyledString* str) override {
+    pb_item()->mutable_str()->set_idx(str->value.index());
+  }
+
+  void Visit(FileReference* file) override {
+    pb_item()->mutable_file()->set_path_idx(file->path.index());
+  }
+
+  void Visit(Id* id) override { pb_item()->mutable_id(); }
+
+  void Visit(RawString* raw_str) override {
+    pb_item()->mutable_raw_str()->set_idx(raw_str->value.index());
+  }
+
+  void Visit(BinaryPrimitive* prim) override {
+    android::Res_value val = {};
+    prim->Flatten(&val);
+
+    pb::Primitive* pb_prim = pb_item()->mutable_prim();
+    pb_prim->set_type(val.dataType);
+    pb_prim->set_data(val.data);
+  }
+
+  void VisitItem(Item* item) override { LOG(FATAL) << "unimplemented item"; }
+
+  void Visit(Attribute* attr) override {
+    pb::Attribute* pb_attr = pb_compound_value()->mutable_attr();
+    pb_attr->set_format_flags(attr->type_mask);
+    pb_attr->set_min_int(attr->min_int);
+    pb_attr->set_max_int(attr->max_int);
+
+    for (auto& symbol : attr->symbols) {
+      pb::Attribute_Symbol* pb_symbol = pb_attr->add_symbols();
+      SerializeItemCommonToPb(symbol.symbol, pb_symbol);
+      SerializeReferenceToPb(symbol.symbol, pb_symbol->mutable_name());
+      pb_symbol->set_value(symbol.value);
+    }
+  }
+
+  void Visit(Style* style) override {
+    pb::Style* pb_style = pb_compound_value()->mutable_style();
+    if (style->parent) {
+      SerializeReferenceToPb(style->parent.value(), pb_style->mutable_parent());
+      SerializeSourceToPb(style->parent.value().GetSource(), source_pool_,
+                          pb_style->mutable_parent_source());
     }
 
-    /**
-     * Constructor to use when expecting to serialize an Item.
-     */
-    PbSerializerVisitor(StringPool* sourcePool, StringPool* symbolPool, pb::Item* outPbItem) :
-            mSourcePool(sourcePool), mSymbolPool(symbolPool), mOutPbValue(nullptr),
-            mOutPbItem(outPbItem) {
+    for (Style::Entry& entry : style->entries) {
+      pb::Style_Entry* pb_entry = pb_style->add_entries();
+      SerializeReferenceToPb(entry.key, pb_entry->mutable_key());
+
+      pb::Item* pb_item = pb_entry->mutable_item();
+      SerializeItemCommonToPb(entry.key, pb_entry);
+      PbSerializerVisitor sub_visitor(source_pool_, symbol_pool_, pb_item);
+      entry.value->Accept(&sub_visitor);
+    }
+  }
+
+  void Visit(Styleable* styleable) override {
+    pb::Styleable* pb_styleable = pb_compound_value()->mutable_styleable();
+    for (Reference& entry : styleable->entries) {
+      pb::Styleable_Entry* pb_entry = pb_styleable->add_entries();
+      SerializeItemCommonToPb(entry, pb_entry);
+      SerializeReferenceToPb(entry, pb_entry->mutable_attr());
+    }
+  }
+
+  void Visit(Array* array) override {
+    pb::Array* pb_array = pb_compound_value()->mutable_array();
+    for (auto& value : array->items) {
+      pb::Array_Entry* pb_entry = pb_array->add_entries();
+      SerializeItemCommonToPb(*value, pb_entry);
+      PbSerializerVisitor sub_visitor(source_pool_, symbol_pool_,
+                                      pb_entry->mutable_item());
+      value->Accept(&sub_visitor);
+    }
+  }
+
+  void Visit(Plural* plural) override {
+    pb::Plural* pb_plural = pb_compound_value()->mutable_plural();
+    const size_t count = plural->values.size();
+    for (size_t i = 0; i < count; i++) {
+      if (!plural->values[i]) {
+        // No plural value set here.
+        continue;
+      }
+
+      pb::Plural_Entry* pb_entry = pb_plural->add_entries();
+      pb_entry->set_arity(SerializePluralEnumToPb(i));
+      pb::Item* pb_element = pb_entry->mutable_item();
+      SerializeItemCommonToPb(*plural->values[i], pb_entry);
+      PbSerializerVisitor sub_visitor(source_pool_, symbol_pool_, pb_element);
+      plural->values[i]->Accept(&sub_visitor);
+    }
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(PbSerializerVisitor);
+
+  pb::Item* pb_item() {
+    if (out_pb_value_) {
+      return out_pb_value_->mutable_item();
+    }
+    return out_pb_item_;
+  }
+
+  pb::CompoundValue* pb_compound_value() {
+    CHECK(out_pb_value_ != nullptr);
+    return out_pb_value_->mutable_compound_value();
+  }
+
+  template <typename T>
+  void SerializeItemCommonToPb(const Item& item, T* pb_item) {
+    SerializeSourceToPb(item.GetSource(), source_pool_,
+                        pb_item->mutable_source());
+    if (!item.GetComment().empty()) {
+      pb_item->set_comment(item.GetComment());
+    }
+  }
+
+  void SerializeReferenceToPb(const Reference& ref, pb::Reference* pb_ref) {
+    if (ref.id) {
+      pb_ref->set_id(ref.id.value().id);
     }
 
-    void visit(Reference* ref) override {
-        serializeReferenceToPb(*ref, getPbItem()->mutable_ref());
+    if (ref.name) {
+      StringPool::Ref symbol_ref =
+          symbol_pool_->MakeRef(ref.name.value().ToString());
+      pb_ref->set_symbol_idx(static_cast<uint32_t>(symbol_ref.index()));
     }
 
-    void visit(String* str) override {
-        getPbItem()->mutable_str()->set_idx(str->value.getIndex());
-    }
+    pb_ref->set_private_(ref.private_reference);
+    pb_ref->set_type(SerializeReferenceTypeToPb(ref.reference_type));
+  }
 
-    void visit(StyledString* str) override {
-        getPbItem()->mutable_str()->set_idx(str->value.getIndex());
-    }
-
-    void visit(FileReference* file) override {
-        getPbItem()->mutable_file()->set_path_idx(file->path.getIndex());
-    }
-
-    void visit(Id* id) override {
-        getPbItem()->mutable_id();
-    }
-
-    void visit(RawString* rawStr) override {
-        getPbItem()->mutable_raw_str()->set_idx(rawStr->value.getIndex());
-    }
-
-    void visit(BinaryPrimitive* prim) override {
-        android::Res_value val = {};
-        prim->flatten(&val);
-
-        pb::Primitive* pbPrim = getPbItem()->mutable_prim();
-        pbPrim->set_type(val.dataType);
-        pbPrim->set_data(val.data);
-    }
-
-    void visitItem(Item* item) override {
-        assert(false && "unimplemented item");
-    }
-
-    void visit(Attribute* attr) override {
-        pb::Attribute* pbAttr = getPbCompoundValue()->mutable_attr();
-        pbAttr->set_format_flags(attr->typeMask);
-        pbAttr->set_min_int(attr->minInt);
-        pbAttr->set_max_int(attr->maxInt);
-
-        for (auto& symbol : attr->symbols) {
-            pb::Attribute_Symbol* pbSymbol = pbAttr->add_symbols();
-            serializeItemCommonToPb(symbol.symbol, pbSymbol);
-            serializeReferenceToPb(symbol.symbol, pbSymbol->mutable_name());
-            pbSymbol->set_value(symbol.value);
-        }
-    }
-
-    void visit(Style* style) override {
-        pb::Style* pbStyle = getPbCompoundValue()->mutable_style();
-        if (style->parent) {
-            serializeReferenceToPb(style->parent.value(), pbStyle->mutable_parent());
-            serializeSourceToPb(style->parent.value().getSource(),
-                                mSourcePool,
-                                pbStyle->mutable_parent_source());
-        }
-
-        for (Style::Entry& entry : style->entries) {
-            pb::Style_Entry* pbEntry = pbStyle->add_entries();
-            serializeReferenceToPb(entry.key, pbEntry->mutable_key());
-
-            pb::Item* pbItem = pbEntry->mutable_item();
-            serializeItemCommonToPb(entry.key, pbEntry);
-            PbSerializerVisitor subVisitor(mSourcePool, mSymbolPool, pbItem);
-            entry.value->accept(&subVisitor);
-        }
-    }
-
-    void visit(Styleable* styleable) override {
-        pb::Styleable* pbStyleable = getPbCompoundValue()->mutable_styleable();
-        for (Reference& entry : styleable->entries) {
-            pb::Styleable_Entry* pbEntry = pbStyleable->add_entries();
-            serializeItemCommonToPb(entry, pbEntry);
-            serializeReferenceToPb(entry, pbEntry->mutable_attr());
-        }
-    }
-
-    void visit(Array* array) override {
-        pb::Array* pbArray = getPbCompoundValue()->mutable_array();
-        for (auto& value : array->items) {
-            pb::Array_Entry* pbEntry = pbArray->add_entries();
-            serializeItemCommonToPb(*value, pbEntry);
-            PbSerializerVisitor subVisitor(mSourcePool, mSymbolPool, pbEntry->mutable_item());
-            value->accept(&subVisitor);
-        }
-    }
-
-    void visit(Plural* plural) override {
-        pb::Plural* pbPlural = getPbCompoundValue()->mutable_plural();
-        const size_t count = plural->values.size();
-        for (size_t i = 0; i < count; i++) {
-            if (!plural->values[i]) {
-                // No plural value set here.
-                continue;
-            }
-
-            pb::Plural_Entry* pbEntry = pbPlural->add_entries();
-            pbEntry->set_arity(serializePluralEnumToPb(i));
-            pb::Item* pbElement = pbEntry->mutable_item();
-            serializeItemCommonToPb(*plural->values[i], pbEntry);
-            PbSerializerVisitor subVisitor(mSourcePool, mSymbolPool, pbElement);
-            plural->values[i]->accept(&subVisitor);
-        }
-    }
-
-private:
-    pb::Item* getPbItem() {
-        if (mOutPbValue) {
-            return mOutPbValue->mutable_item();
-        }
-        return mOutPbItem;
-    }
-
-    pb::CompoundValue* getPbCompoundValue() {
-        assert(mOutPbValue);
-        return mOutPbValue->mutable_compound_value();
-    }
-
-    template <typename T>
-    void serializeItemCommonToPb(const Item& item, T* pbItem) {
-        serializeSourceToPb(item.getSource(), mSourcePool, pbItem->mutable_source());
-        if (!item.getComment().empty()) {
-            pbItem->set_comment(item.getComment());
-        }
-    }
-
-    void serializeReferenceToPb(const Reference& ref, pb::Reference* pbRef) {
-        if (ref.id) {
-            pbRef->set_id(ref.id.value().id);
-        }
-
-        if (ref.name) {
-            StringPool::Ref symbolRef = mSymbolPool->makeRef(ref.name.value().toString());
-            pbRef->set_symbol_idx(static_cast<uint32_t>(symbolRef.getIndex()));
-        }
-
-        pbRef->set_private_(ref.privateReference);
-        pbRef->set_type(serializeReferenceTypeToPb(ref.referenceType));
-    }
-
-    StringPool* mSourcePool;
-    StringPool* mSymbolPool;
-    pb::Value* mOutPbValue;
-    pb::Item* mOutPbItem;
+  StringPool* source_pool_;
+  StringPool* symbol_pool_;
+  pb::Value* out_pb_value_;
+  pb::Item* out_pb_item_;
 };
 
-} // namespace
+}  // namespace
 
-std::unique_ptr<pb::ResourceTable> serializeTableToPb(ResourceTable* table) {
-    // We must do this before writing the resources, since the string pool IDs may change.
-    table->stringPool.sort([](const StringPool::Entry& a, const StringPool::Entry& b) -> bool {
+std::unique_ptr<pb::ResourceTable> SerializeTableToPb(ResourceTable* table) {
+  // We must do this before writing the resources, since the string pool IDs may
+  // change.
+  table->string_pool.Sort(
+      [](const StringPool::Entry& a, const StringPool::Entry& b) -> bool {
         int diff = a.context.priority - b.context.priority;
         if (diff < 0) return true;
         if (diff > 0) return false;
@@ -211,192 +219,195 @@
         if (diff < 0) return true;
         if (diff > 0) return false;
         return a.value < b.value;
-    });
-    table->stringPool.prune();
+      });
+  table->string_pool.Prune();
 
-    auto pbTable = util::make_unique<pb::ResourceTable>();
-    serializeStringPoolToPb(table->stringPool, pbTable->mutable_string_pool());
+  auto pb_table = util::make_unique<pb::ResourceTable>();
+  SerializeStringPoolToPb(table->string_pool, pb_table->mutable_string_pool());
 
-    StringPool sourcePool, symbolPool;
+  StringPool source_pool, symbol_pool;
 
-    for (auto& package : table->packages) {
-        pb::Package* pbPackage = pbTable->add_packages();
-        if (package->id) {
-            pbPackage->set_package_id(package->id.value());
+  for (auto& package : table->packages) {
+    pb::Package* pb_package = pb_table->add_packages();
+    if (package->id) {
+      pb_package->set_package_id(package->id.value());
+    }
+    pb_package->set_package_name(package->name);
+
+    for (auto& type : package->types) {
+      pb::Type* pb_type = pb_package->add_types();
+      if (type->id) {
+        pb_type->set_id(type->id.value());
+      }
+      pb_type->set_name(ToString(type->type).ToString());
+
+      for (auto& entry : type->entries) {
+        pb::Entry* pb_entry = pb_type->add_entries();
+        if (entry->id) {
+          pb_entry->set_id(entry->id.value());
         }
-        pbPackage->set_package_name(package->name);
+        pb_entry->set_name(entry->name);
 
-        for (auto& type : package->types) {
-            pb::Type* pbType = pbPackage->add_types();
-            if (type->id) {
-                pbType->set_id(type->id.value());
-            }
-            pbType->set_name(toString(type->type).toString());
+        // Write the SymbolStatus struct.
+        pb::SymbolStatus* pb_status = pb_entry->mutable_symbol_status();
+        pb_status->set_visibility(
+            SerializeVisibilityToPb(entry->symbol_status.state));
+        SerializeSourceToPb(entry->symbol_status.source, &source_pool,
+                            pb_status->mutable_source());
+        pb_status->set_comment(entry->symbol_status.comment);
 
-            for (auto& entry : type->entries) {
-                pb::Entry* pbEntry = pbType->add_entries();
-                if (entry->id) {
-                    pbEntry->set_id(entry->id.value());
-                }
-                pbEntry->set_name(entry->name);
+        for (auto& config_value : entry->values) {
+          pb::ConfigValue* pb_config_value = pb_entry->add_config_values();
+          SerializeConfig(config_value->config,
+                          pb_config_value->mutable_config());
+          if (!config_value->product.empty()) {
+            pb_config_value->mutable_config()->set_product(
+                config_value->product);
+          }
 
-                // Write the SymbolStatus struct.
-                pb::SymbolStatus* pbStatus = pbEntry->mutable_symbol_status();
-                pbStatus->set_visibility(serializeVisibilityToPb(entry->symbolStatus.state));
-                serializeSourceToPb(entry->symbolStatus.source, &sourcePool,
-                                    pbStatus->mutable_source());
-                pbStatus->set_comment(entry->symbolStatus.comment);
+          pb::Value* pb_value = pb_config_value->mutable_value();
+          SerializeSourceToPb(config_value->value->GetSource(), &source_pool,
+                              pb_value->mutable_source());
+          if (!config_value->value->GetComment().empty()) {
+            pb_value->set_comment(config_value->value->GetComment());
+          }
 
-                for (auto& configValue : entry->values) {
-                    pb::ConfigValue* pbConfigValue = pbEntry->add_config_values();
-                    serializeConfig(configValue->config, pbConfigValue->mutable_config());
-                    if (!configValue->product.empty()) {
-                        pbConfigValue->mutable_config()->set_product(configValue->product);
-                    }
+          if (config_value->value->IsWeak()) {
+            pb_value->set_weak(true);
+          }
 
-                    pb::Value* pbValue = pbConfigValue->mutable_value();
-                    serializeSourceToPb(configValue->value->getSource(), &sourcePool,
-                                        pbValue->mutable_source());
-                    if (!configValue->value->getComment().empty()) {
-                        pbValue->set_comment(configValue->value->getComment());
-                    }
-
-                    if (configValue->value->isWeak()) {
-                        pbValue->set_weak(true);
-                    }
-
-                    PbSerializerVisitor visitor(&sourcePool, &symbolPool, pbValue);
-                    configValue->value->accept(&visitor);
-                }
-            }
+          PbSerializerVisitor visitor(&source_pool, &symbol_pool, pb_value);
+          config_value->value->Accept(&visitor);
         }
+      }
     }
+  }
 
-    serializeStringPoolToPb(sourcePool, pbTable->mutable_source_pool());
-    serializeStringPoolToPb(symbolPool, pbTable->mutable_symbol_pool());
-    return pbTable;
+  SerializeStringPoolToPb(source_pool, pb_table->mutable_source_pool());
+  SerializeStringPoolToPb(symbol_pool, pb_table->mutable_symbol_pool());
+  return pb_table;
 }
 
-std::unique_ptr<pb::CompiledFile> serializeCompiledFileToPb(const ResourceFile& file) {
-    auto pbFile = util::make_unique<pb::CompiledFile>();
-    pbFile->set_resource_name(file.name.toString());
-    pbFile->set_source_path(file.source.path);
-    serializeConfig(file.config, pbFile->mutable_config());
+std::unique_ptr<pb::CompiledFile> SerializeCompiledFileToPb(
+    const ResourceFile& file) {
+  auto pb_file = util::make_unique<pb::CompiledFile>();
+  pb_file->set_resource_name(file.name.ToString());
+  pb_file->set_source_path(file.source.path);
+  SerializeConfig(file.config, pb_file->mutable_config());
 
-    for (const SourcedResourceName& exported : file.exportedSymbols) {
-        pb::CompiledFile_Symbol* pbSymbol = pbFile->add_exported_symbols();
-        pbSymbol->set_resource_name(exported.name.toString());
-        pbSymbol->set_line_no(exported.line);
-    }
-    return pbFile;
+  for (const SourcedResourceName& exported : file.exported_symbols) {
+    pb::CompiledFile_Symbol* pb_symbol = pb_file->add_exported_symbols();
+    pb_symbol->set_resource_name(exported.name.ToString());
+    pb_symbol->set_line_no(exported.line);
+  }
+  return pb_file;
 }
 
-CompiledFileOutputStream::CompiledFileOutputStream(ZeroCopyOutputStream* out) : mOut(out) {
-}
+CompiledFileOutputStream::CompiledFileOutputStream(ZeroCopyOutputStream* out)
+    : out_(out) {}
 
-void CompiledFileOutputStream::ensureAlignedWrite() {
-    const int padding = mOut.ByteCount() % 4;
-    if (padding > 0) {
-        uint32_t zero = 0u;
-        mOut.WriteRaw(&zero, padding);
-    }
+void CompiledFileOutputStream::EnsureAlignedWrite() {
+  const int padding = out_.ByteCount() % 4;
+  if (padding > 0) {
+    uint32_t zero = 0u;
+    out_.WriteRaw(&zero, padding);
+  }
 }
 
 void CompiledFileOutputStream::WriteLittleEndian32(uint32_t val) {
-    ensureAlignedWrite();
-    mOut.WriteLittleEndian32(val);
+  EnsureAlignedWrite();
+  out_.WriteLittleEndian32(val);
 }
 
-void CompiledFileOutputStream::WriteCompiledFile(const pb::CompiledFile* compiledFile) {
-    ensureAlignedWrite();
-    mOut.WriteLittleEndian64(static_cast<uint64_t>(compiledFile->ByteSize()));
-    compiledFile->SerializeWithCachedSizes(&mOut);
+void CompiledFileOutputStream::WriteCompiledFile(
+    const pb::CompiledFile* compiled_file) {
+  EnsureAlignedWrite();
+  out_.WriteLittleEndian64(static_cast<uint64_t>(compiled_file->ByteSize()));
+  compiled_file->SerializeWithCachedSizes(&out_);
 }
 
 void CompiledFileOutputStream::WriteData(const BigBuffer* buffer) {
-    ensureAlignedWrite();
-    mOut.WriteLittleEndian64(static_cast<uint64_t>(buffer->size()));
-    for (const BigBuffer::Block& block : *buffer) {
-        mOut.WriteRaw(block.buffer.get(), block.size);
-    }
+  EnsureAlignedWrite();
+  out_.WriteLittleEndian64(static_cast<uint64_t>(buffer->size()));
+  for (const BigBuffer::Block& block : *buffer) {
+    out_.WriteRaw(block.buffer.get(), block.size);
+  }
 }
 
 void CompiledFileOutputStream::WriteData(const void* data, size_t len) {
-    ensureAlignedWrite();
-    mOut.WriteLittleEndian64(static_cast<uint64_t>(len));
-    mOut.WriteRaw(data, len);
+  EnsureAlignedWrite();
+  out_.WriteLittleEndian64(static_cast<uint64_t>(len));
+  out_.WriteRaw(data, len);
 }
 
-bool CompiledFileOutputStream::HadError() {
-    return mOut.HadError();
+bool CompiledFileOutputStream::HadError() { return out_.HadError(); }
+
+CompiledFileInputStream::CompiledFileInputStream(const void* data, size_t size)
+    : in_(static_cast<const uint8_t*>(data), size) {}
+
+void CompiledFileInputStream::EnsureAlignedRead() {
+  const int padding = in_.CurrentPosition() % 4;
+  if (padding > 0) {
+    // Reads are always 4 byte aligned.
+    in_.Skip(padding);
+  }
 }
 
-CompiledFileInputStream::CompiledFileInputStream(const void* data, size_t size) :
-        mIn(static_cast<const uint8_t*>(data), size) {
+bool CompiledFileInputStream::ReadLittleEndian32(uint32_t* out_val) {
+  EnsureAlignedRead();
+  return in_.ReadLittleEndian32(out_val);
 }
 
-void CompiledFileInputStream::ensureAlignedRead() {
-    const int padding = mIn.CurrentPosition() % 4;
-    if (padding > 0) {
-        // Reads are always 4 byte aligned.
-        mIn.Skip(padding);
-    }
+bool CompiledFileInputStream::ReadCompiledFile(pb::CompiledFile* out_val) {
+  EnsureAlignedRead();
+
+  uint64_t pb_size = 0u;
+  if (!in_.ReadLittleEndian64(&pb_size)) {
+    return false;
+  }
+
+  CodedInputStream::Limit l = in_.PushLimit(static_cast<int>(pb_size));
+
+  // Check that we haven't tried to read past the end.
+  if (static_cast<uint64_t>(in_.BytesUntilLimit()) != pb_size) {
+    in_.PopLimit(l);
+    in_.PushLimit(0);
+    return false;
+  }
+
+  if (!out_val->ParsePartialFromCodedStream(&in_)) {
+    in_.PopLimit(l);
+    in_.PushLimit(0);
+    return false;
+  }
+
+  in_.PopLimit(l);
+  return true;
 }
 
-bool CompiledFileInputStream::ReadLittleEndian32(uint32_t* outVal) {
-    ensureAlignedRead();
-    return mIn.ReadLittleEndian32(outVal);
+bool CompiledFileInputStream::ReadDataMetaData(uint64_t* out_offset,
+                                               uint64_t* out_len) {
+  EnsureAlignedRead();
+
+  uint64_t pb_size = 0u;
+  if (!in_.ReadLittleEndian64(&pb_size)) {
+    return false;
+  }
+
+  // Check that we aren't trying to read past the end.
+  if (pb_size > static_cast<uint64_t>(in_.BytesUntilLimit())) {
+    in_.PushLimit(0);
+    return false;
+  }
+
+  uint64_t offset = static_cast<uint64_t>(in_.CurrentPosition());
+  if (!in_.Skip(pb_size)) {
+    return false;
+  }
+
+  *out_offset = offset;
+  *out_len = pb_size;
+  return true;
 }
 
-bool CompiledFileInputStream::ReadCompiledFile(pb::CompiledFile* outVal) {
-    ensureAlignedRead();
-
-    uint64_t pbSize = 0u;
-    if (!mIn.ReadLittleEndian64(&pbSize)) {
-        return false;
-    }
-
-    CodedInputStream::Limit l = mIn.PushLimit(static_cast<int>(pbSize));
-
-    // Check that we haven't tried to read past the end.
-    if (static_cast<uint64_t>(mIn.BytesUntilLimit()) != pbSize) {
-        mIn.PopLimit(l);
-        mIn.PushLimit(0);
-        return false;
-    }
-
-    if (!outVal->ParsePartialFromCodedStream(&mIn)) {
-        mIn.PopLimit(l);
-        mIn.PushLimit(0);
-        return false;
-    }
-
-    mIn.PopLimit(l);
-    return true;
-}
-
-bool CompiledFileInputStream::ReadDataMetaData(uint64_t* outOffset, uint64_t* outLen) {
-    ensureAlignedRead();
-
-    uint64_t pbSize = 0u;
-    if (!mIn.ReadLittleEndian64(&pbSize)) {
-        return false;
-    }
-
-    // Check that we aren't trying to read past the end.
-    if (pbSize > static_cast<uint64_t>(mIn.BytesUntilLimit())) {
-        mIn.PushLimit(0);
-        return false;
-    }
-
-    uint64_t offset = static_cast<uint64_t>(mIn.CurrentPosition());
-    if (!mIn.Skip(pbSize)) {
-        return false;
-    }
-
-    *outOffset = offset;
-    *outLen = pbSize;
-    return true;
-}
-
-} // namespace aapt
+}  // namespace aapt