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

Side by Side Diff: content/zygote/zygote_main_linux.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « content/zygote/zygote_linux.cc ('k') | crypto/secure_hash_default.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/zygote/zygote_main.h" 5 #include "content/zygote/zygote_main.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 second->Run(); 86 second->Run();
87 } 87 }
88 88
89 } // namespace 89 } // namespace
90 90
91 // See http://code.google.com/p/chromium/wiki/LinuxZygote 91 // See http://code.google.com/p/chromium/wiki/LinuxZygote
92 92
93 static void ProxyLocaltimeCallToBrowser(time_t input, struct tm* output, 93 static void ProxyLocaltimeCallToBrowser(time_t input, struct tm* output,
94 char* timezone_out, 94 char* timezone_out,
95 size_t timezone_out_len) { 95 size_t timezone_out_len) {
96 Pickle request; 96 base::Pickle request;
97 request.WriteInt(LinuxSandbox::METHOD_LOCALTIME); 97 request.WriteInt(LinuxSandbox::METHOD_LOCALTIME);
98 request.WriteString( 98 request.WriteString(
99 std::string(reinterpret_cast<char*>(&input), sizeof(input))); 99 std::string(reinterpret_cast<char*>(&input), sizeof(input)));
100 100
101 uint8_t reply_buf[512]; 101 uint8_t reply_buf[512];
102 const ssize_t r = UnixDomainSocket::SendRecvMsg( 102 const ssize_t r = UnixDomainSocket::SendRecvMsg(
103 GetSandboxFD(), reply_buf, sizeof(reply_buf), NULL, 103 GetSandboxFD(), reply_buf, sizeof(reply_buf), NULL,
104 request); 104 request);
105 if (r == -1) { 105 if (r == -1) {
106 memset(output, 0, sizeof(struct tm)); 106 memset(output, 0, sizeof(struct tm));
107 return; 107 return;
108 } 108 }
109 109
110 Pickle reply(reinterpret_cast<char*>(reply_buf), r); 110 base::Pickle reply(reinterpret_cast<char*>(reply_buf), r);
111 PickleIterator iter(reply); 111 base::PickleIterator iter(reply);
112 std::string result, timezone; 112 std::string result, timezone;
113 if (!iter.ReadString(&result) || 113 if (!iter.ReadString(&result) ||
114 !iter.ReadString(&timezone) || 114 !iter.ReadString(&timezone) ||
115 result.size() != sizeof(struct tm)) { 115 result.size() != sizeof(struct tm)) {
116 memset(output, 0, sizeof(struct tm)); 116 memset(output, 0, sizeof(struct tm));
117 return; 117 return;
118 } 118 }
119 119
120 memcpy(output, result.data(), sizeof(struct tm)); 120 memcpy(output, result.data(), sizeof(struct tm));
121 if (timezone_out_len) { 121 if (timezone_out_len) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; 610 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS;
611 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); 611 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged);
612 612
613 Zygote zygote(sandbox_flags, fork_delegates.Pass(), extra_children, 613 Zygote zygote(sandbox_flags, fork_delegates.Pass(), extra_children,
614 extra_fds); 614 extra_fds);
615 // This function call can return multiple times, once per fork(). 615 // This function call can return multiple times, once per fork().
616 return zygote.ProcessRequests(); 616 return zygote.ProcessRequests();
617 } 617 }
618 618
619 } // namespace content 619 } // namespace content
OLDNEW
« no previous file with comments | « content/zygote/zygote_linux.cc ('k') | crypto/secure_hash_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698