mobile/android/components/build/nsAndroidHistory.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/components/build/nsAndroidHistory.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef NS_ANDROIDHISTORY_H
    1.10 +#define NS_ANDROIDHISTORY_H
    1.11 +
    1.12 +#include "IHistory.h"
    1.13 +#include "nsDataHashtable.h"
    1.14 +#include "nsTPriorityQueue.h"
    1.15 +#include "nsIRunnable.h"
    1.16 +
    1.17 +#define NS_ANDROIDHISTORY_CID \
    1.18 +    {0xCCAA4880, 0x44DD, 0x40A7, {0xA1, 0x3F, 0x61, 0x56, 0xFC, 0x88, 0x2C, 0x0B}}
    1.19 +
    1.20 +// Max size of History::mRecentlyVisitedURIs
    1.21 +#define RECENTLY_VISITED_URI_SIZE 8
    1.22 +
    1.23 +// Max size of History::mEmbedURIs
    1.24 +#define EMBED_URI_SIZE 128
    1.25 +
    1.26 +class nsAndroidHistory : public mozilla::IHistory, public nsIRunnable
    1.27 +{
    1.28 +public:
    1.29 +  NS_DECL_ISUPPORTS
    1.30 +  NS_DECL_IHISTORY
    1.31 +  NS_DECL_NSIRUNNABLE
    1.32 +
    1.33 +  /**
    1.34 +   * Obtains a pointer that has had AddRef called on it.  Used by the service
    1.35 +   * manager only.
    1.36 +   */
    1.37 +  static nsAndroidHistory* GetSingleton();
    1.38 +
    1.39 +  nsAndroidHistory();
    1.40 +
    1.41 +private:
    1.42 +  static nsAndroidHistory* sHistory;
    1.43 +
    1.44 +  nsDataHashtable<nsStringHashKey, nsTArray<mozilla::dom::Link *> *> mListeners;
    1.45 +  nsTPriorityQueue<nsString> mPendingURIs;
    1.46 +
    1.47 +  nsresult CanAddURI(nsIURI* aURI, bool* canAdd);
    1.48 +
    1.49 +  /**
    1.50 +   * mRecentlyVisitedURIs remembers URIs which are recently added to the DB,
    1.51 +   * to avoid saving these locations repeatedly in a short period.
    1.52 +   */
    1.53 +  typedef nsAutoTArray<nsCOMPtr<nsIURI>, RECENTLY_VISITED_URI_SIZE>
    1.54 +          RecentlyVisitedArray;
    1.55 +  RecentlyVisitedArray mRecentlyVisitedURIs;
    1.56 +  RecentlyVisitedArray::index_type mRecentlyVisitedURIsNextIndex;
    1.57 +
    1.58 +  void AppendToRecentlyVisitedURIs(nsIURI* aURI);
    1.59 +  bool IsRecentlyVisitedURI(nsIURI* aURI);
    1.60 +
    1.61 +  /**
    1.62 +   * mEmbedURIs remembers URIs which are explicitly not added to the DB,
    1.63 +   * to avoid wasting time on these locations.
    1.64 +   */
    1.65 +  typedef nsAutoTArray<nsCOMPtr<nsIURI>, EMBED_URI_SIZE> EmbedArray;
    1.66 +  EmbedArray::index_type mEmbedURIsNextIndex;
    1.67 +  EmbedArray mEmbedURIs;
    1.68 +
    1.69 +  void AppendToEmbedURIs(nsIURI* aURI);
    1.70 +  bool IsEmbedURI(nsIURI* aURI);
    1.71 +};
    1.72 +
    1.73 +#endif

mercurial