mobile/android/components/build/nsAndroidHistory.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef NS_ANDROIDHISTORY_H
michael@0 7 #define NS_ANDROIDHISTORY_H
michael@0 8
michael@0 9 #include "IHistory.h"
michael@0 10 #include "nsDataHashtable.h"
michael@0 11 #include "nsTPriorityQueue.h"
michael@0 12 #include "nsIRunnable.h"
michael@0 13
michael@0 14 #define NS_ANDROIDHISTORY_CID \
michael@0 15 {0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}
michael@0 16
michael@0 17 // Max size of History::mRecentlyVisitedURIs
michael@0 18 #define RECENTLY_VISITED_URI_SIZE 8
michael@0 19
michael@0 20 // Max size of History::mEmbedURIs
michael@0 21 #define EMBED_URI_SIZE 128
michael@0 22
michael@0 23 class nsAndroidHistory : public mozilla::IHistory, public nsIRunnable
michael@0 24 {
michael@0 25 public:
michael@0 26 NS_DECL_ISUPPORTS
michael@0 27 NS_DECL_IHISTORY
michael@0 28 NS_DECL_NSIRUNNABLE
michael@0 29
michael@0 30 /**
michael@0 31 * Obtains a pointer that has had AddRef called on it. Used by the service
michael@0 32 * manager only.
michael@0 33 */
michael@0 34 static nsAndroidHistory* GetSingleton();
michael@0 35
michael@0 36 nsAndroidHistory();
michael@0 37
michael@0 38 private:
michael@0 39 static nsAndroidHistory* sHistory;
michael@0 40
michael@0 41 nsDataHashtable<nsStringHashKey, nsTArray<mozilla::dom::Link *> *> mListeners;
michael@0 42 nsTPriorityQueue<nsString> mPendingURIs;
michael@0 43
michael@0 44 nsresult CanAddURI(nsIURI* aURI, bool* canAdd);
michael@0 45
michael@0 46 /**
michael@0 47 * mRecentlyVisitedURIs remembers URIs which are recently added to the DB,
michael@0 48 * to avoid saving these locations repeatedly in a short period.
michael@0 49 */
michael@0 50 typedef nsAutoTArray<nsCOMPtr<nsIURI>, RECENTLY_VISITED_URI_SIZE>
michael@0 51 RecentlyVisitedArray;
michael@0 52 RecentlyVisitedArray mRecentlyVisitedURIs;
michael@0 53 RecentlyVisitedArray::index_type mRecentlyVisitedURIsNextIndex;
michael@0 54
michael@0 55 void AppendToRecentlyVisitedURIs(nsIURI* aURI);
michael@0 56 bool IsRecentlyVisitedURI(nsIURI* aURI);
michael@0 57
michael@0 58 /**
michael@0 59 * mEmbedURIs remembers URIs which are explicitly not added to the DB,
michael@0 60 * to avoid wasting time on these locations.
michael@0 61 */
michael@0 62 typedef nsAutoTArray<nsCOMPtr<nsIURI>, EMBED_URI_SIZE> EmbedArray;
michael@0 63 EmbedArray::index_type mEmbedURIsNextIndex;
michael@0 64 EmbedArray mEmbedURIs;
michael@0 65
michael@0 66 void AppendToEmbedURIs(nsIURI* aURI);
michael@0 67 bool IsEmbedURI(nsIURI* aURI);
michael@0 68 };
michael@0 69
michael@0 70 #endif

mercurial