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

Side by Side Diff: public/platform/WebThreadSafeData.h

Issue 1162773003: [Blob] Dependencies for blob storage testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comments Created 5 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
« no previous file with comments | « public/platform/WebBlobData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class RawData; 43 class RawData;
44 44
45 // A container for raw bytes. It is inexpensive to copy a WebThreadSafeData obje ct. 45 // A container for raw bytes. It is inexpensive to copy a WebThreadSafeData obje ct.
46 // It is safe to pass a WebThreadSafeData across threads!!! 46 // It is safe to pass a WebThreadSafeData across threads!!!
47 class WebThreadSafeData { 47 class WebThreadSafeData {
48 public: 48 public:
49 WebThreadSafeData() { } 49 WebThreadSafeData() { }
50 ~WebThreadSafeData() { reset(); } 50 ~WebThreadSafeData() { reset(); }
51 51
52 BLINK_PLATFORM_EXPORT void assign(const WebThreadSafeData&); 52 BLINK_PLATFORM_EXPORT void assign(const WebThreadSafeData&);
53 // For testing use only.
pdr. 2015/06/02 20:26:16 Other than two instances in WebLayer.h, I don't se
54 BLINK_PLATFORM_EXPORT void assign(const char* data, size_t length);
55
53 BLINK_PLATFORM_EXPORT void reset(); 56 BLINK_PLATFORM_EXPORT void reset();
54 57
55 BLINK_PLATFORM_EXPORT size_t size() const; 58 BLINK_PLATFORM_EXPORT size_t size() const;
56 BLINK_PLATFORM_EXPORT const char* data() const; 59 BLINK_PLATFORM_EXPORT const char* data() const;
57 60
58 bool isEmpty() const { return !size(); } 61 bool isEmpty() const { return !size(); }
59 62
60 #if INSIDE_BLINK 63 #if INSIDE_BLINK
61 BLINK_PLATFORM_EXPORT WebThreadSafeData(const WTF::PassRefPtr<RawData>&); 64 BLINK_PLATFORM_EXPORT WebThreadSafeData(const WTF::PassRefPtr<RawData>&);
62 BLINK_PLATFORM_EXPORT WebThreadSafeData& operator=(const WTF::PassRefPtr<Raw Data>&); 65 BLINK_PLATFORM_EXPORT WebThreadSafeData& operator=(const WTF::PassRefPtr<Raw Data>&);
63 #else 66 #else
64 operator std::string() const 67 operator std::string() const
65 { 68 {
66 size_t len = size(); 69 size_t len = size();
67 return len ? std::string(data(), len) : std::string(); 70 return len ? std::string(data(), len) : std::string();
68 } 71 }
69 #endif 72 #endif
70 73
71 private: 74 private:
72 WebPrivatePtr<RawData> m_private; 75 WebPrivatePtr<RawData> m_private;
73 }; 76 };
74 77
75 } // namespace blink 78 } // namespace blink
76 79
77 #endif 80 #endif
OLDNEW
« no previous file with comments | « public/platform/WebBlobData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698