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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/SQLError.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 12 matching lines...) Expand all
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29 #ifndef SQLError_h 29 #ifndef SQLError_h
30 #define SQLError_h 30 #define SQLError_h
31 31
32 #include "bindings/core/v8/ScriptWrappable.h" 32 #include "bindings/core/v8/ScriptWrappable.h"
33 #include "wtf/PtrUtil.h"
34 #include "wtf/text/WTFString.h" 33 #include "wtf/text/WTFString.h"
35 #include <memory>
36 34
37 namespace blink { 35 namespace blink {
38 36
39 class SQLErrorData { 37 class SQLErrorData {
40 USING_FAST_MALLOC(SQLErrorData); 38 USING_FAST_MALLOC(SQLErrorData);
41 public: 39 public:
42 static std::unique_ptr<SQLErrorData> create(unsigned code, const String& mes sage) 40 static PassOwnPtr<SQLErrorData> create(unsigned code, const String& message)
43 { 41 {
44 return wrapUnique(new SQLErrorData(code, message)); 42 return adoptPtr(new SQLErrorData(code, message));
45 } 43 }
46 44
47 static std::unique_ptr<SQLErrorData> create(unsigned code, const char* messa ge, int sqliteCode, const char* sqliteMessage) 45 static PassOwnPtr<SQLErrorData> create(unsigned code, const char* message, i nt sqliteCode, const char* sqliteMessage)
48 { 46 {
49 return create(code, String::format("%s (%d %s)", message, sqliteCode, sq liteMessage)); 47 return create(code, String::format("%s (%d %s)", message, sqliteCode, sq liteMessage));
50 } 48 }
51 49
52 static std::unique_ptr<SQLErrorData> create(const SQLErrorData& data) 50 static PassOwnPtr<SQLErrorData> create(const SQLErrorData& data)
53 { 51 {
54 return create(data.code(), data.message()); 52 return create(data.code(), data.message());
55 } 53 }
56 54
57 SQLErrorData(const SQLErrorData& data) : m_code(data.m_code), m_message(data .m_message.isolatedCopy()) { } 55 SQLErrorData(const SQLErrorData& data) : m_code(data.m_code), m_message(data .m_message.isolatedCopy()) { }
58 56
59 unsigned code() const { return m_code; } 57 unsigned code() const { return m_code; }
60 String message() const { return m_message.isolatedCopy(); } 58 String message() const { return m_message.isolatedCopy(); }
61 59
62 private: 60 private:
(...skipping 30 matching lines...) Expand all
93 private: 91 private:
94 explicit SQLError(const SQLErrorData& data) 92 explicit SQLError(const SQLErrorData& data)
95 : m_data(data) { } 93 : m_data(data) { }
96 94
97 const SQLErrorData m_data; 95 const SQLErrorData m_data;
98 }; 96 };
99 97
100 } // namespace blink 98 } // namespace blink
101 99
102 #endif // SQLError_h 100 #endif // SQLError_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698