1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 #include "chrome/browser/sessions/session_command.h"
9 #include "base/pickle.h"
11 SessionCommand::SessionCommand(id_type id
, size_type size
)
16 SessionCommand::SessionCommand(id_type id
, const Pickle
& pickle
)
18 contents_(pickle
.size(), 0) {
19 DCHECK(pickle
.size() < std::numeric_limits
<size_type
>::max());
20 memcpy(contents(), pickle
.data(), pickle
.size());
23 bool SessionCommand::GetPayload(void* dest
, size_t count
) const {
26 memcpy(dest
, &(contents_
[0]), count
);
30 Pickle
* SessionCommand::PayloadAsPickle() const {
31 return new Pickle(contents(), static_cast<int>(size()));