Give MtpDevice members more meaningful names.

BUG=none
TEST=none

Change-Id: I7dca6bce61abc254aa1d7857bede6fc981a99a5c
Reviewed-on: https://chromium-review.googlesource.com/490537
Commit-Ready: Lei Zhang <thestig@chromium.org>
Tested-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/device_manager.cc b/device_manager.cc
index e7d940f..d37362e 100644
--- a/device_manager.cc
+++ b/device_manager.cc
@@ -141,7 +141,7 @@
   for (MtpDeviceMap::const_iterator device_it = device_map_.begin();
        device_it != device_map_.end(); ++device_it) {
     const std::string& usb_bus_str = device_it->first;
-    const MtpStorageMap& storage_map = device_it->second.second;
+    const MtpStorageMap& storage_map = device_it->second.storage_map;
     for (MtpStorageMap::const_iterator storage_it = storage_map.begin();
          storage_it != storage_map.end(); ++storage_it) {
       ret.push_back(StorageToString(usb_bus_str, storage_it->first));
@@ -168,7 +168,7 @@
   if (device_it == device_map_.end())
     return nullptr;
 
-  const MtpStorageMap& storage_map = device_it->second.second;
+  const MtpStorageMap& storage_map = device_it->second.storage_map;
   MtpStorageMap::const_iterator storage_it = storage_map.find(storage_id);
   return storage_it != storage_map.end() ? &storage_it->second : nullptr;
 }
@@ -186,8 +186,8 @@
     return nullptr;
 
   // Update |storage_map| with the latest storage info.
-  MtpStorageMap& storage_map = device_it->second.second;
-  LIBMTP_mtpdevice_t* mtp_device = device_it->second.first;
+  MtpStorageMap& storage_map = device_it->second.storage_map;
+  LIBMTP_mtpdevice_t* mtp_device = device_it->second.device;
   LIBMTP_Get_Storage(mtp_device, LIBMTP_STORAGE_SORTBY_NOTSORTED);
   for (LIBMTP_devicestorage_t* storage = mtp_device->storage; storage;
        storage = storage->next) {
@@ -394,11 +394,11 @@
   // Existing device case.
   // There should be no real LIBMTP_mtpdevice_t device for this dummy storage.
   MtpDevice& existing_mtp_device = it->second;
-  if (existing_mtp_device.first)
+  if (existing_mtp_device.device)
     return false;
 
   // And the storage should not already exist.
-  MtpStorageMap& existing_mtp_storage_map = existing_mtp_device.second;
+  MtpStorageMap& existing_mtp_storage_map = existing_mtp_device.storage_map;
   if (ContainsKey(existing_mtp_storage_map, storage_id))
     return false;
 
@@ -515,12 +515,12 @@
   if (device_it == device_map_.end())
     return false;
 
-  const MtpStorageMap& storage_map = device_it->second.second;
+  const MtpStorageMap& storage_map = device_it->second.storage_map;
   if (!ContainsKey(storage_map, id))
     return false;
 
   *storage_id = id;
-  *mtp_device = device_it->second.first;
+  *mtp_device = device_it->second.device;
   return true;
 }
 
@@ -652,7 +652,7 @@
         continue;
       }
     } else {
-      mtp_device = device_map_[usb_bus_str].first;
+      mtp_device = device_map_[usb_bus_str].device;
 
       // For existing devices, update the storage lists.
       if (LIBMTP_Get_Storage(mtp_device, LIBMTP_STORAGE_SORTBY_NOTSORTED) < 0) {
@@ -678,7 +678,7 @@
     if (add_update)
       storage_map_ptr = &new_storage_map;
     else
-      storage_map_ptr = &device_map_[usb_bus_str].second;
+      storage_map_ptr = &device_map_[usb_bus_str].storage_map;
 
     // Compute the set of storage ids that are contained in the mtpd's
     // storage_map but not in the latest device info. They are removed storages.
@@ -774,7 +774,7 @@
 
     // Remove all the storages on that device.
     const std::string& usb_bus_str = device_it->first;
-    const MtpStorageMap& storage_map = device_it->second.second;
+    const MtpStorageMap& storage_map = device_it->second.storage_map;
     for (MtpStorageMap::const_iterator storage_it = storage_map.begin();
          storage_it != storage_map.end(); ++storage_it) {
       delegate_->StorageDetached(
@@ -782,8 +782,8 @@
     }
 
     // Delete the device's map entry and cleanup.
-    LIBMTP_mtpdevice_t* mtp_device = device_it->second.first;
-    linked_ptr<base::SimpleThread> p_thread(device_it->second.third);
+    LIBMTP_mtpdevice_t* mtp_device = device_it->second.device;
+    linked_ptr<base::SimpleThread> p_thread(device_it->second.watcher_thread);
     device_map_.erase(device_it);
 
     // |mtp_device| can be NULL in testing.
diff --git a/device_manager.h b/device_manager.h
index e5d8ced..368d55b 100644
--- a/device_manager.h
+++ b/device_manager.h
@@ -129,22 +129,26 @@
  private:
   // Key: MTP storage id, Value: metadata for the given storage.
   using MtpStorageMap = std::map<uint32_t, StorageInfo>;
+
   // (device handle, map of storages on the device, device polling thread)
   struct MtpDevice {
-    LIBMTP_mtpdevice_t* first;
-    MtpStorageMap second;
-    linked_ptr<base::SimpleThread> third;
+    LIBMTP_mtpdevice_t* device;
+    MtpStorageMap storage_map;
+    linked_ptr<base::SimpleThread> watcher_thread;
 
-    MtpDevice() : first(nullptr) {}
+    MtpDevice() : device(nullptr) {}
 
     MtpDevice(LIBMTP_mtpdevice_t* d,
               const MtpStorageMap& m,
               base::SimpleThread* t)
-        : first(d), second(m), third(t) {}
+        : device(d), storage_map(m), watcher_thread(t) {}
 
     MtpDevice(const MtpDevice& rhs)
-        : first(rhs.first), second(rhs.second), third(rhs.third) {}
+        : device(rhs.device),
+          storage_map(rhs.storage_map),
+          watcher_thread(rhs.watcher_thread) {}
   };
+
   // Key: device bus location, Value: MtpDevice.
   using MtpDeviceMap = std::map<std::string, MtpDevice>;