Bug 1184667 - Remove some unnecessary const_casts from ActorsParent.cpp. r=janv
authorReuben Morais <reuben.morais@gmail.com>
Wed, 05 Aug 2015 15:25:14 -0300
changeset 288036 56e99d4a3f04b699f6b57f7067b5b9f41773fc7f
parent 288035 17fa99523554d760c67a46ed2c982c66d847ca77
child 288037 6b426219238600d21c00bd620940b551d4a99e39
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanv
bugs1184667
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1184667 - Remove some unnecessary const_casts from ActorsParent.cpp. r=janv
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -6718,17 +6718,17 @@ struct FactoryOp::MaybeBlockedDatabaseIn
 class OpenDatabaseOp final
   : public FactoryOp
 {
   friend class Database;
   friend class VersionChangeTransaction;
 
   class VersionChangeOp;
 
-  const OptionalContentId mOptionalContentParentId;
+  OptionalContentId mOptionalContentParentId;
 
   nsRefPtr<FullDatabaseMetadata> mMetadata;
 
   uint64_t mRequestedVersion;
   nsString mDatabaseFilePath;
   nsRefPtr<FileManager> mFileManager;
 
   nsRefPtr<Database> mDatabase;
@@ -7234,17 +7234,17 @@ class ObjectStoreAddOrPutRequestOp final
 
   nsRefPtr<FileManager> mFileManager;
 
   Key mResponse;
   const nsCString mGroup;
   const nsCString mOrigin;
   const PersistenceType mPersistenceType;
   const bool mOverwrite;
-  const bool mObjectStoreMayHaveIndexes;
+  bool mObjectStoreMayHaveIndexes;
 
 private:
   // Only created by TransactionBase.
   ObjectStoreAddOrPutRequestOp(TransactionBase* aTransaction,
                                const RequestParams& aParams);
 
   ~ObjectStoreAddOrPutRequestOp()
   { }
@@ -7352,17 +7352,17 @@ private:
 
 class ObjectStoreDeleteRequestOp final
   : public NormalTransactionOp
 {
   friend class TransactionBase;
 
   const ObjectStoreDeleteParams mParams;
   ObjectStoreDeleteResponse mResponse;
-  const bool mObjectStoreMayHaveIndexes;
+  bool mObjectStoreMayHaveIndexes;
 
 private:
   ObjectStoreDeleteRequestOp(TransactionBase* aTransaction,
                              const ObjectStoreDeleteParams& aParams);
 
   ~ObjectStoreDeleteRequestOp()
   { }
 
@@ -7378,17 +7378,17 @@ private:
 
 class ObjectStoreClearRequestOp final
   : public NormalTransactionOp
 {
   friend class TransactionBase;
 
   const ObjectStoreClearParams mParams;
   ObjectStoreClearResponse mResponse;
-  const bool mObjectStoreMayHaveIndexes;
+  bool mObjectStoreMayHaveIndexes;
 
 private:
   ObjectStoreClearRequestOp(TransactionBase* aTransaction,
                             const ObjectStoreClearParams& aParams);
 
   ~ObjectStoreClearRequestOp()
   { }
 
@@ -18785,25 +18785,22 @@ OpenDatabaseOp::OpenDatabaseOp(Factory* 
                                already_AddRefed<ContentParent> aContentParent,
                                const CommonFactoryRequestParams& aParams)
   : FactoryOp(aFactory, Move(aContentParent), aParams, /* aDeleting */ false)
   , mMetadata(new FullDatabaseMetadata(aParams.metadata()))
   , mRequestedVersion(aParams.metadata().version())
   , mVersionChangeOp(nullptr)
   , mTelemetryId(0)
 {
-  auto& optionalContentParentId =
-    const_cast<OptionalContentId&>(mOptionalContentParentId);
-
   if (mContentParent) {
     // This is a little scary but it looks safe to call this off the main thread
     // for now.
-    optionalContentParentId = mContentParent->ChildID();
-  } else {
-    optionalContentParentId = void_t();
+    mOptionalContentParentId = mContentParent->ChildID();
+  } else {
+    mOptionalContentParentId = void_t();
   }
 }
 
 void
 OpenDatabaseOp::ActorDestroy(ActorDestroyReason aWhy)
 {
   AssertIsOnOwningThread();
 
@@ -22629,17 +22626,17 @@ ObjectStoreAddOrPutRequestOp::ObjectStor
 {
   MOZ_ASSERT(aParams.type() == RequestParams::TObjectStoreAddParams ||
              aParams.type() == RequestParams::TObjectStorePutParams);
 
   mMetadata =
     aTransaction->GetMetadataForObjectStoreId(mParams.objectStoreId());
   MOZ_ASSERT(mMetadata);
 
-  const_cast<bool&>(mObjectStoreMayHaveIndexes) = mMetadata->HasLiveIndexes();
+  mObjectStoreMayHaveIndexes = mMetadata->HasLiveIndexes();
 }
 
 nsresult
 ObjectStoreAddOrPutRequestOp::RemoveOldIndexDataValues(
                                                 DatabaseConnection* aConnection)
 {
   AssertIsOnConnectionThread();
   MOZ_ASSERT(aConnection);
@@ -23560,17 +23557,17 @@ ObjectStoreDeleteRequestOp::ObjectStoreD
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aTransaction);
 
   nsRefPtr<FullObjectStoreMetadata> metadata =
     aTransaction->GetMetadataForObjectStoreId(mParams.objectStoreId());
   MOZ_ASSERT(metadata);
 
-  const_cast<bool&>(mObjectStoreMayHaveIndexes) = metadata->HasLiveIndexes();
+  mObjectStoreMayHaveIndexes = metadata->HasLiveIndexes();
 }
 
 nsresult
 ObjectStoreDeleteRequestOp::DoDatabaseWork(DatabaseConnection* aConnection)
 {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   PROFILER_LABEL("IndexedDB",
@@ -23652,17 +23649,17 @@ ObjectStoreClearRequestOp::ObjectStoreCl
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aTransaction);
 
   nsRefPtr<FullObjectStoreMetadata> metadata =
     aTransaction->GetMetadataForObjectStoreId(mParams.objectStoreId());
   MOZ_ASSERT(metadata);
 
-  const_cast<bool&>(mObjectStoreMayHaveIndexes) = metadata->HasLiveIndexes();
+  mObjectStoreMayHaveIndexes = metadata->HasLiveIndexes();
 }
 
 nsresult
 ObjectStoreClearRequestOp::DoDatabaseWork(DatabaseConnection* aConnection)
 {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();