1 // Copyright 2006 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 "base/pickle.h"
8 #include "components/sessions/session_command.h"
12 SessionCommand::SessionCommand(id_type id
, size_type size
)
17 SessionCommand::SessionCommand(id_type id
, const Pickle
& pickle
)
19 contents_(pickle
.size(), 0) {
20 DCHECK(pickle
.size() < std::numeric_limits
<size_type
>::max());
21 memcpy(contents(), pickle
.data(), pickle
.size());
24 bool SessionCommand::GetPayload(void* dest
, size_t count
) const {
27 memcpy(dest
, &(contents_
[0]), count
);
31 Pickle
* SessionCommand::PayloadAsPickle() const {
32 return new Pickle(contents(), static_cast<int>(size()));
35 } // namespace sessions