diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 00:35:01 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 00:35:01 +0000 |
commit | 21f977570e42b26a9c50da35bf8d12e44645371a (patch) | |
tree | 79d2c7ceb5dd24a3ddef8a02590a2786e6768b0e /base/rand_util_nacl.cc | |
parent | 8df26d4b2c07009cca88c4082bee5a4acff16a77 (diff) | |
download | chromium_src-21f977570e42b26a9c50da35bf8d12e44645371a.zip chromium_src-21f977570e42b26a9c50da35bf8d12e44645371a.tar.gz chromium_src-21f977570e42b26a9c50da35bf8d12e44645371a.tar.bz2 |
Add untrusted NaCl build for PPAPI proxy.
This patch refactors ppapi_shared.gypi and ppapi_proxy.gypi into proper includes, adds ppapi_shared_untrusted and ppapi_proxy_untrusted .gyp files, and integrates them into the nacl_irt build (ppapi/native_client/native_client.gyp). In order to build without link errors, it includes our plugin side initialization of PluginDispatcher, and a PpapiPluginMain definition. When the 'build_ppapi_ipc_proxy_untrusted' gyp flag is set to '1', this will build a working NaCl IRT using the Chrome IPC proxy.
BUG=116317
TEST=compiles, runs HelloWorld and GetURL SDK examples.
Review URL: https://chromiumcodereview.appspot.com/10565015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/rand_util_nacl.cc')
-rw-r--r-- | base/rand_util_nacl.cc | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/base/rand_util_nacl.cc b/base/rand_util_nacl.cc deleted file mode 100644 index 718da05..0000000 --- a/base/rand_util_nacl.cc +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/rand_util.h" - -#include "base/lazy_instance.h" -#include "base/logging.h" - -// TODO(bbudge) Replace this with a proper system header file when NaCl -// provides one. -#include "native_client/src/untrusted/irt/irt.h" - -namespace { - -// Create a wrapper class so we can cache the NaCl random number interface. -class URandomInterface { - public: - URandomInterface() { - size_t result = nacl_interface_query(NACL_IRT_RANDOM_v0_1, - &interface_, - sizeof(interface_)); - DCHECK_EQ(result, sizeof(interface_)) << "Can't get random interface."; - } - - uint64 get_random_bytes() const { - size_t nbytes; - uint64 result; - int error = interface_.get_random_bytes(&result, - sizeof(result), - &nbytes); - DCHECK_EQ(error, 0); - DCHECK_EQ(nbytes, sizeof(result)); - return result; - } - - private: - struct nacl_irt_random interface_; -}; - -base::LazyInstance<URandomInterface> g_urandom_interface = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - -namespace base { - -uint64 RandUint64() { - return g_urandom_interface.Pointer()->get_random_bytes(); -} - -} // namespace base - |