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

Unified Diff: src/pdf/SkPDFTypes.h

Issue 360473005: Add lock to SkPDFDict (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: response to sunshine comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFStream.cpp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFTypes.h
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 1f06c4c5fe63dc4cac3efb5991d066601ee97499..004c767843a569ac16f060e6495ac7751aa6813e 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -369,7 +369,7 @@ public:
/** The size of the dictionary.
*/
- int size() { return fValue.count(); }
+ int size() const;
/** Add the value to the dictionary with the given key. Refs value.
* @param key The key for this dictionary entry.
@@ -424,28 +424,30 @@ public:
*/
void clear();
+protected:
+ /** Use to remove a single key from the dictionary.
+ */
+ void remove(const char key[]);
+
+ /** Insert references to all of the key-value pairs from the other
+ * dictionary into this one.
+ */
+ void mergeFrom(const SkPDFDict& other);
+
private:
struct Rec {
- SkPDFName* key;
- SkPDFObject* value;
+ SkPDFName* key;
+ SkPDFObject* value;
+ Rec(SkPDFName* k, SkPDFObject* v) : key(k), value(v) {}
};
-public:
- class Iter {
- public:
- explicit Iter(const SkPDFDict& dict);
- SkPDFName* next(SkPDFObject** value);
-
- private:
- const Rec* fIter;
- const Rec* fStop;
- };
-
-private:
static const int kMaxLen = 4095;
+ mutable SkMutex fMutex; // protects modifications to fValue
SkTDArray<struct Rec> fValue;
+ SkPDFObject* append(SkPDFName* key, SkPDFObject* value);
+
typedef SkPDFObject INHERITED;
};
« no previous file with comments | « src/pdf/SkPDFStream.cpp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698