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

Side by Side Diff: base/rand_util_posix.cc

Issue 6410105: run iwyu on base! Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « base/rand_util.cc ('k') | base/ref_counted.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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 "base/rand_util.h" 5 #include <stdbool.h>
6 #include "base/rand_util_c.h" 6 #include <sys/errno.h>
7 7 #include <sys/fcntl.h>
8 #include <errno.h>
9 #include <fcntl.h>
10 #include <unistd.h> 8 #include <unistd.h>
11 9
10 #include "base/basictypes.h"
12 #include "base/file_util.h" 11 #include "base/file_util.h"
13 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
14 #include "base/logging.h" 13 #include "base/logging.h"
15 14
16 namespace { 15 namespace {
17 16
18 // We keep the file descriptor for /dev/urandom around so we don't need to 17 // We keep the file descriptor for /dev/urandom around so we don't need to
19 // reopen it (which is expensive), and since we may not even be able to reopen 18 // reopen it (which is expensive), and since we may not even be able to reopen
20 // it if we are later put in a sandbox. This class wraps the file descriptor so 19 // it if we are later put in a sandbox. This class wraps the file descriptor so
21 // we can use LazyInstance to handle opening it on the first access. 20 // we can use LazyInstance to handle opening it on the first access.
(...skipping 30 matching lines...) Expand all
52 CHECK(success); 51 CHECK(success);
53 52
54 return number; 53 return number;
55 } 54 }
56 55
57 } // namespace base 56 } // namespace base
58 57
59 int GetUrandomFD(void) { 58 int GetUrandomFD(void) {
60 return g_urandom_fd.Pointer()->fd(); 59 return g_urandom_fd.Pointer()->fd();
61 } 60 }
OLDNEW
« no previous file with comments | « base/rand_util.cc ('k') | base/ref_counted.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698