summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_sync_message.h
diff options
context:
space:
mode:
authorjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 20:42:56 +0000
committerjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 20:42:56 +0000
commitce208f877048d4c7bbb57e0df045f0f39a9c80bf (patch)
tree24210ee34fc2c341d9d45c722e2941c9ab8ce768 /ipc/ipc_sync_message.h
parentd1f43abcb958e76806007d59f75f2da6078be89e (diff)
downloadchromium_src-ce208f877048d4c7bbb57e0df045f0f39a9c80bf.zip
chromium_src-ce208f877048d4c7bbb57e0df045f0f39a9c80bf.tar.gz
chromium_src-ce208f877048d4c7bbb57e0df045f0f39a9c80bf.tar.bz2
Refactor Pickle Read methods to use higher performance PickleIterator.
There was a lot of redundant error checking and initialization code in all Pickle Read methods because of the void** iterator type. This change replaces the void* iterator with PickleIterator, which encapsulates the read pointer so that less error checking and initialization code is needed for reading. PickleIterator has all the necessary data to do the actual reading. The advantage of having it provide Read methods (as opposed to leaving them solely in the Pickle interface) is that the callers do not need to pass around the const Pickle* once they have a PickleIterator. Followup CLs will refactor the call sites to remove const Pickle* arguments where they are now unnecessary. Then the Pickle::Read* methods can be removed entirely. The alternative approach would have been to change the Pickle::Read methods to non-const and remove the iterator parameter (making Read methods advance an internal read pointer). Unfortunately, the const Read with iterator design is entrenched throughout the chromium code, making this a much more complex change with the same performance outcome. BUG=13108 Review URL: https://chromiumcodereview.appspot.com/9447084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125447 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_message.h')
-rw-r--r--ipc/ipc_sync_message.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h
index 087df0d..17a7324 100644
--- a/ipc/ipc_sync_message.h
+++ b/ipc/ipc_sync_message.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -61,7 +61,7 @@ class IPC_EXPORT SyncMessage : public Message {
// Given a reply message, returns an iterator to the beginning of the data
// (i.e. skips over the synchronous specific data).
- static void* GetDataIterator(const Message* msg);
+ static PickleIterator GetDataIterator(const Message* msg);
// Given a synchronous message (or its reply), returns its id.
static int GetMessageId(const Message& msg);
@@ -90,7 +90,8 @@ class IPC_EXPORT MessageReplyDeserializer {
private:
// Derived classes need to implement this, using the given iterator (which
// is skipped past the header for synchronous messages).
- virtual bool SerializeOutputParameters(const Message& msg, void* iter) = 0;
+ virtual bool SerializeOutputParameters(const Message& msg,
+ PickleIterator iter) = 0;
};
// When sending a synchronous message, this structure contains an object