[M120 Migration][VD] Remove accessing oom_score_adj in zygote process
[platform/framework/web/chromium-efl.git] / printing / page_range.cc
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "printing/page_range.h"
6
7 #include <stddef.h>
8
9 #include <algorithm>
10 #include <set>
11
12 namespace printing {
13
14 // static
15 void PageRange::Normalize(PageRanges& ranges) {
16   std::sort(ranges.begin(), ranges.end());
17   PageRanges::iterator dst = ranges.begin();
18   for (PageRanges::iterator src = ranges.begin() + 1; src < ranges.end();
19        ++src) {
20     if (dst->to + 1 < src->from) {
21       *++dst = *src;
22       continue;
23     }
24     dst->to = std::max(dst->to, src->to);
25   }
26   if (dst < ranges.end())
27     dst++;
28   ranges.resize(dst - ranges.begin());
29 }
30
31 }  // namespace printing