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

Side by Side Diff: sql/mojo/vfs_unittest.cc

Issue 1445003002: Use std::default_delete as the default deleter for scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: How many trial and errors before this builds on the Windows bots Created 5 years, 1 month 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 | « rlz/lib/rlz_lib.cc ('k') | ui/accessibility/ax_node_data.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory>
6
5 #include "components/filesystem/public/interfaces/file_system.mojom.h" 7 #include "components/filesystem/public/interfaces/file_system.mojom.h"
6 #include "mojo/application/public/cpp/application_impl.h" 8 #include "mojo/application/public/cpp/application_impl.h"
7 #include "mojo/application/public/cpp/application_test_base.h" 9 #include "mojo/application/public/cpp/application_test_base.h"
8 #include "mojo/util/capture_util.h" 10 #include "mojo/util/capture_util.h"
9 #include "sql/mojo/mojo_vfs.h" 11 #include "sql/mojo/mojo_vfs.h"
10 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/sqlite/sqlite3.h" 13 #include "third_party/sqlite/sqlite3.h"
12 14
13 namespace base { 15 namespace std {
14 16
15 // This deleter lets us be safe with sqlite3 objects, which aren't really the 17 // This deleter lets us be safe with sqlite3 objects, which aren't really the
16 // structs, but slabs of new uint8_t[size]. 18 // structs, but slabs of new uint8_t[size].
17 template <> 19 template <>
18 struct DefaultDeleter<sqlite3_file> { 20 struct default_delete<sqlite3_file> {
19 inline void operator()(sqlite3_file* ptr) const { 21 inline void operator()(sqlite3_file* ptr) const {
20 // Why don't we call file->pMethods->xClose() here? Because it's not 22 // Why don't we call file->pMethods->xClose() here? Because it's not
21 // guaranteed to be valid. sqlite3_file "objects" can be in partially 23 // guaranteed to be valid. sqlite3_file "objects" can be in partially
22 // initialized states. 24 // initialized states.
23 delete [] reinterpret_cast<uint8_t*>(ptr); 25 delete [] reinterpret_cast<uint8_t*>(ptr);
24 } 26 }
25 }; 27 };
26 28
27 } // namespace base 29 } // namespace std
28 30
29 namespace sql { 31 namespace sql {
30 32
31 const char kFileName[] = "TestingDatabase.db"; 33 const char kFileName[] = "TestingDatabase.db";
32 34
33 class VFSTest : public mojo::test::ApplicationTestBase, 35 class VFSTest : public mojo::test::ApplicationTestBase,
34 public filesystem::FileSystemClient { 36 public filesystem::FileSystemClient {
35 public: 37 public:
36 VFSTest() : binding_(this) {} 38 VFSTest() : binding_(this) {}
37 ~VFSTest() override {} 39 ~VFSTest() override {}
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 EXPECT_EQ(SQLITE_OK, rc); 332 EXPECT_EQ(SQLITE_OK, rc);
331 333
332 rc = file->pMethods->xFileSize(file.get(), &size); 334 rc = file->pMethods->xFileSize(file.get(), &size);
333 EXPECT_EQ(SQLITE_OK, rc); 335 EXPECT_EQ(SQLITE_OK, rc);
334 EXPECT_EQ(kCharsToThree, size); 336 EXPECT_EQ(kCharsToThree, size);
335 337
336 file->pMethods->xClose(file.get()); 338 file->pMethods->xClose(file.get());
337 } 339 }
338 340
339 } // namespace sql 341 } // namespace sql
OLDNEW
« no previous file with comments | « rlz/lib/rlz_lib.cc ('k') | ui/accessibility/ax_node_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698