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

Unified Diff: src/pdf/SkPDFTypes.h

Issue 360473005: Add lock to SkPDFDict (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: src/pdf/SkPDFTypes.h
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 1f06c4c5fe63dc4cac3efb5991d066601ee97499..1adad5a2fe94c32293d6af099de2114b4b39a877 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 { return fValue.count(); }
mtklein 2014/06/27 15:26:52 If fMutex guards fValue, why isn't this locked?
hal.canary 2014/06/27 16:03:28 Done.
/** 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 referecnes to all of the key-value pairs from the other
mtklein 2014/06/27 15:26:51 spelling
hal.canary 2014/06/27 16:03:28 Done.
+ * dictionary into this one.
+ */
+ void insertDict(const SkPDFDict& other);
mtklein 2014/06/27 15:26:51 maybe mergeFrom?
hal.canary 2014/06/27 16:03:27 Done.
+
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;
+ SkMutex fMutex; // protects modifications to fValue
SkTDArray<struct Rec> fValue;
+ SkPDFObject* appendRec(SkPDFName* key, SkPDFObject* value);
mtklein 2014/06/27 15:26:52 Just my opinion, but the Rec bit here doesn't real
hal.canary 2014/06/27 16:03:28 Done.
+
typedef SkPDFObject INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698