~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/pagespeed/kernel/base/scoped_ptr.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2012 Google Inc.
3
 
 *
4
 
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 
 * you may not use this file except in compliance with the License.
6
 
 * You may obtain a copy of the License at
7
 
 *
8
 
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
10
 
 * Unless required by applicable law or agreed to in writing, software
11
 
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 
 * See the License for the specific language governing permissions and
14
 
 * limitations under the License.
15
 
 */
16
 
 
17
 
// Author: lsong@google.com (Libo Song)
18
 
 
19
 
#ifndef PAGESPEED_KERNEL_BASE_SCOPED_PTR_H_
20
 
#define PAGESPEED_KERNEL_BASE_SCOPED_PTR_H_
21
 
 
22
 
 
23
 
// Chromium has moved scoped_ptr.h from base directory to base/memory.
24
 
// Thankfully, even older version we built against had it available in
25
 
// base/memory, just with the compatibility alias still available.
26
 
#include "base/memory/scoped_ptr.h"
27
 
 
28
 
// Note that this expression is carefully crafted so that someone compiling
29
 
// against PSOL libraries will compile using the Chromium version of
30
 
// scoped_array.  This ifdef enables PageSpeed Insights to incrementally
31
 
// upgrade to a new version of Chromium that does not have scoped_array,
32
 
// but does have an array specialization for scoped_ptr.
33
 
#if defined(CHROMIUM_REVISION) && CHROMIUM_REVISION <= 194649
34
 
#define INSTAWEB_HAVE_SCOPED_ARRAY
35
 
#endif
36
 
 
37
 
 
38
 
namespace net_instaweb {
39
 
 
40
 
#ifdef INSTAWEB_HAVE_SCOPED_ARRAY
41
 
 
42
 
// TODO(jmarantz): Remove this once we update Chromium to a version
43
 
// greater than 194649, which will support specialization of arrays.
44
 
template<typename T> class scoped_array : public ::scoped_array<T> {
45
 
 public:
46
 
  scoped_array() : ::scoped_array<T>() {}
47
 
  explicit scoped_array(T* t) : ::scoped_array<T>(t) {}
48
 
};
49
 
 
50
 
#else
51
 
 
52
 
template<typename T> class scoped_array : public scoped_ptr<T[]> {
53
 
 public:
54
 
  scoped_array() : scoped_ptr<T[]>() {}
55
 
  explicit scoped_array(T* t) : scoped_ptr<T[]>(t) {}
56
 
};
57
 
 
58
 
#endif  // INSTAWEB_HAVE_SCOPED_ARRAY
59
 
 
60
 
}  // namespace net_instaweb
61
 
 
62
 
#endif  // PAGESPEED_KERNEL_BASE_SCOPED_PTR_H_