Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: components/sessions/session_command.cc

Issue 1361613002: Move all core files in //components/sessions into core/ subdir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/sessions/session_command.h ('k') | components/sessions/session_id.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include <limits>
6
7 #include "base/pickle.h"
8 #include "components/sessions/session_command.h"
9
10 namespace sessions {
11
12 SessionCommand::SessionCommand(id_type id, size_type size)
13 : id_(id),
14 contents_(size, 0) {
15 }
16
17 SessionCommand::SessionCommand(id_type id, const base::Pickle& pickle)
18 : id_(id),
19 contents_(pickle.size(), 0) {
20 DCHECK(pickle.size() < std::numeric_limits<size_type>::max());
21 memcpy(contents(), pickle.data(), pickle.size());
22 }
23
24 bool SessionCommand::GetPayload(void* dest, size_t count) const {
25 if (size() != count)
26 return false;
27 memcpy(dest, &(contents_[0]), count);
28 return true;
29 }
30
31 base::Pickle* SessionCommand::PayloadAsPickle() const {
32 return new base::Pickle(contents(), static_cast<int>(size()));
33 }
34
35 } // namespace sessions
OLDNEW
« no previous file with comments | « components/sessions/session_command.h ('k') | components/sessions/session_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698