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

Side by Side Diff: third_party/leveldatabase/port/port_chromium.cc

Issue 7522008: Move chromium-specific files from leveldb to chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change parameter to const ref Created 9 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The LevelDB 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. See the AUTHORS file for names of contributors.
4
5 #include "port/port_chromium.h"
6
7 #include "util/logging.h"
8
9 #if defined(USE_SNAPPY)
10 # include "third_party/snappy/src/snappy.h"
11 #endif
12
13 namespace leveldb {
14 namespace port {
15
16 Mutex::Mutex() {
17 }
18
19 Mutex::~Mutex() {
20 }
21
22 void Mutex::Lock() {
23 mu_.Acquire();
24 }
25
26 void Mutex::Unlock() {
27 mu_.Release();
28 }
29
30 void Mutex::AssertHeld() {
31 mu_.AssertAcquired();
32 }
33
34 CondVar::CondVar(Mutex* mu)
35 : cv_(&mu->mu_) {
36 }
37
38 CondVar::~CondVar() { }
39
40 void CondVar::Wait() {
41 cv_.Wait();
42 }
43
44 void CondVar::Signal(){
45 cv_.Signal();
46 }
47
48 void CondVar::SignalAll() {
49 cv_.Broadcast();
50 }
51
52 bool Snappy_Compress(const char* input, size_t input_length,
53 std::string* output) {
54 #if defined(USE_SNAPPY)
55 output->resize(snappy::MaxCompressedLength(input_length));
56 size_t outlen;
57 snappy::RawCompress(input, input_length, &(*output)[0], &outlen);
58 output->resize(outlen);
59 return true;
60 #else
61 return false;
62 #endif
63 }
64
65 bool Snappy_GetUncompressedLength(const char* input, size_t length,
66 size_t* result) {
67 #if defined(USE_SNAPPY)
68 return snappy::GetUncompressedLength(input_data, input_length, result);
69 #else
70 return false;
71 #endif
72 }
73
74 bool Snappy_Uncompress(const char* input_data, size_t input_length,
75 char* output) {
76 #if defined(USE_SNAPPY)
77 return snappy::RawUncompress(input_data, input_length, output);
78 #else
79 return false;
80 #endif
81 }
82
83 }
84 }
OLDNEW
« no previous file with comments | « third_party/leveldatabase/port/port_chromium.h ('k') | webkit/fileapi/file_system_directory_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698