/**
   * * Add or update a cache. CACHE_URL_COL is unique in the table.
   *
   * @param url The url
   * @param c The CacheManager.CacheResult
   */
  void addCache(String url, CacheResult c) {
    assert !JniUtil.useChromiumHttpStack();

    if (url == null || !checkInitialized()) {
      return;
    }

    mCacheInserter.prepareForInsert();
    mCacheInserter.bind(mCacheUrlColIndex, url);
    mCacheInserter.bind(mCacheFilePathColIndex, c.localPath);
    mCacheInserter.bind(mCacheLastModifyColIndex, c.lastModified);
    mCacheInserter.bind(mCacheETagColIndex, c.etag);
    mCacheInserter.bind(mCacheExpiresColIndex, c.expires);
    mCacheInserter.bind(mCacheExpiresStringColIndex, c.expiresString);
    mCacheInserter.bind(mCacheMimeTypeColIndex, c.mimeType);
    mCacheInserter.bind(mCacheEncodingColIndex, c.encoding);
    mCacheInserter.bind(mCacheHttpStatusColIndex, c.httpStatusCode);
    mCacheInserter.bind(mCacheLocationColIndex, c.location);
    mCacheInserter.bind(mCacheContentLengthColIndex, c.contentLength);
    mCacheInserter.bind(mCacheContentDispositionColIndex, c.contentdisposition);
    mCacheInserter.bind(mCacheCrossDomainColIndex, c.crossDomain);
    mCacheInserter.execute();
  }
    private boolean addDefaultBookmarks(SQLiteDatabase db, long parentId, long firstBookmarkId) {
      long bookmarkId = firstBookmarkId;
      Resources res = getContext().getResources();
      final CharSequence[] bookmarks = res.getTextArray(R.array.bookmarks);
      int size = bookmarks.length;
      TypedArray preloads = res.obtainTypedArray(R.array.bookmark_preloads);
      DatabaseUtils.InsertHelper insertHelper = null;
      try {
        insertHelper = new DatabaseUtils.InsertHelper(db, TABLE_BOOKMARKS);
        final int idColumn = insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.ID);
        final int titleColumn =
            insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.TITLE);
        final int urlColumn = insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.URL);
        final int typeColumn = insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.TYPE);
        final int parentColumn =
            insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.PARENT);
        final int faviconColumn =
            insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.FAVICON);
        final int touchiconColumn =
            insertHelper.getColumnIndex(PartnerBookmarksContract.Bookmarks.TOUCHICON);

        for (int i = 0; i + 1 < size; i = i + 2) {
          CharSequence bookmarkDestination = bookmarks[i + 1];

          String bookmarkTitle = bookmarks[i].toString();
          String bookmarkUrl = bookmarkDestination.toString();
          byte[] favicon = null;
          if (i < preloads.length()) {
            int faviconId = preloads.getResourceId(i, 0);
            try {
              favicon = readRaw(res, faviconId);
            } catch (IOException e) {
              Log.i(TAG, "Failed to read favicon for " + bookmarkTitle, e);
            }
          }
          byte[] touchicon = null;
          if (i + 1 < preloads.length()) {
            int touchiconId = preloads.getResourceId(i + 1, 0);
            try {
              touchicon = readRaw(res, touchiconId);
            } catch (IOException e) {
              Log.i(TAG, "Failed to read touchicon for " + bookmarkTitle, e);
            }
          }
          insertHelper.prepareForInsert();
          insertHelper.bind(idColumn, bookmarkId);
          insertHelper.bind(titleColumn, bookmarkTitle);
          insertHelper.bind(urlColumn, bookmarkUrl);
          insertHelper.bind(typeColumn, PartnerBookmarksContract.Bookmarks.BOOKMARK_TYPE_BOOKMARK);
          insertHelper.bind(parentColumn, parentId);
          if (favicon != null) {
            insertHelper.bind(faviconColumn, favicon);
          }
          if (touchicon != null) {
            insertHelper.bind(touchiconColumn, touchicon);
          }
          bookmarkId++;
          if (insertHelper.execute() == -1) {
            Log.i(TAG, "Failed to insert bookmark " + bookmarkTitle);
            return false;
          }
        }
      } finally {
        preloads.recycle();
        insertHelper.close();
      }
      return true;
    }