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

Unified Diff: chrome/browser/renderer_host/render_sandbox_host_linux.cc

Issue 155783: Linux sandbox: plumb timezone calls through the sandbox (Closed)
Patch Set: ... Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/zygote_main_linux.cc » ('j') | chrome/browser/zygote_main_linux.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_sandbox_host_linux.cc
diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
index de68170d6426fb8b9ba4844fcfc5176e0350b270..f7ca1451d27ebd00ac06553bc74e9fa9910960b9 100644
--- a/chrome/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
@@ -9,6 +9,7 @@
#include <sys/uio.h>
#include <sys/socket.h>
#include <sys/poll.h>
+#include <time.h>
#include "base/eintr_wrapper.h"
#include "base/process_util.h"
@@ -176,6 +177,8 @@ class SandboxIPCProcess : public WebKitClient {
HandleFontOpenRequest(fd, pickle, iter, fds);
} else if (kind == LinuxSandbox::METHOD_GET_FONT_FAMILY_FOR_CHARS) {
HandleGetFontFamilyForChars(fd, pickle, iter, fds);
+ } else if (kind == LinuxSandbox::METHOD_LOCALTIME) {
+ HandleLocaltime(fd, pickle, iter, fds);
}
error:
@@ -281,6 +284,29 @@ class SandboxIPCProcess : public WebKitClient {
SendRendererReply(fds, reply, -1);
}
+ void HandleLocaltime(int fd, Pickle& pickle, void* iter,
+ std::vector<int>& fds) {
+ // The other side of this call is in zygote_main_linux.cc
+
+ std::string time_string;
+ if (!pickle.ReadString(&iter, &time_string) ||
+ time_string.size() != sizeof(time_t)) {
+ return;
+ }
+
+ time_t time;
+ memcpy(&time, time_string.data(), sizeof(time));
+ struct tm expanded_time;
+ localtime_r(&time, &expanded_time);
+
+ const std::string result_string(reinterpret_cast<char*>(&expanded_time),
+ sizeof(expanded_time));
+
+ Pickle reply;
+ reply.WriteString(result_string);
+ SendRendererReply(fds, reply, -1);
+ }
+
void SendRendererReply(const std::vector<int>& fds, const Pickle& reply,
int reply_fd) {
struct msghdr msg;
« no previous file with comments | « no previous file | chrome/browser/zygote_main_linux.cc » ('j') | chrome/browser/zygote_main_linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698