summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profiles/storage_partition_descriptor.h
blob: 39bc769aa55ba03616c0fe8ea841d5371bd29b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_
#define CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_

#include "base/files/file_path.h"
#include "base/hash_tables.h"

// This structure combines a StoragePartition's on-disk path and a boolean for
// whether the partition should be persisted on disk. Its purpose is to serve as
// a unique key to look up RequestContext objects in the ProfileIOData derived
// classes.
struct StoragePartitionDescriptor {
  StoragePartitionDescriptor(const base::FilePath& partition_path,
                             const bool in_memory_only)
    : path(partition_path),
      in_memory(in_memory_only) {}

  const base::FilePath path;
  const bool in_memory;
};

// Functor for operator <.
struct StoragePartitionDescriptorLess {
  bool operator()(const StoragePartitionDescriptor& lhs,
                  const StoragePartitionDescriptor& rhs) const {
    if (lhs.path != rhs.path)
      return lhs.path < rhs.path;
    else if (lhs.in_memory != rhs.in_memory)
      return lhs.in_memory < rhs.in_memory;
    else
      return false;
  }
};

#endif  // CHROME_BROWSER_PROFILES_STORAGE_PARTITION_DESCRIPTOR_H_