Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/themes/browser_theme_pack.h

Issue 747013003: Various optimizations to reduce the number of temporary allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back calls to c_str that were removed by mistake. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ 5 #ifndef CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_
6 #define CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ 6 #define CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // the case where the theme has invalid data. 60 // the case where the theme has invalid data.
61 static scoped_refptr<BrowserThemePack> BuildFromExtension( 61 static scoped_refptr<BrowserThemePack> BuildFromExtension(
62 const extensions::Extension* extension); 62 const extensions::Extension* extension);
63 63
64 // Builds the theme pack from a previously performed WriteToDisk(). This 64 // Builds the theme pack from a previously performed WriteToDisk(). This
65 // operation should be relatively fast, as it should be an mmap() and some 65 // operation should be relatively fast, as it should be an mmap() and some
66 // pointer swizzling. Returns NULL on any error attempting to read |path|. 66 // pointer swizzling. Returns NULL on any error attempting to read |path|.
67 static scoped_refptr<BrowserThemePack> BuildFromDataPack( 67 static scoped_refptr<BrowserThemePack> BuildFromDataPack(
68 const base::FilePath& path, const std::string& expected_id); 68 const base::FilePath& path, const std::string& expected_id);
69 69
70 // Returns the set of image IDRs which can be overwritten by a user provided 70 // Returns whether the specified identifier is one of the images we persist
71 // theme. 71 // in the data pack.
72 static void GetThemeableImageIDRs(std::set<int>* result); 72 static bool IsPersistentImageID(int id);
73 73
74 // Builds a data pack on disk at |path| for future quick loading by 74 // Builds a data pack on disk at |path| for future quick loading by
75 // BuildFromDataPack(). Often (but not always) called from the file thread; 75 // BuildFromDataPack(). Often (but not always) called from the file thread;
76 // implementation should be threadsafe because neither thread will write to 76 // implementation should be threadsafe because neither thread will write to
77 // |image_memory_| and the worker thread will keep a reference to prevent 77 // |image_memory_| and the worker thread will keep a reference to prevent
78 // destruction. 78 // destruction.
79 bool WriteToDisk(const base::FilePath& path) const; 79 bool WriteToDisk(const base::FilePath& path) const;
80 80
81 // Overridden from CustomThemeSupplier: 81 // Overridden from CustomThemeSupplier:
82 bool GetTint(int id, color_utils::HSL* hsl) const override; 82 bool GetTint(int id, color_utils::HSL* hsl) const override;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // Cache of images created in BuildFromExtension(). Once the theme pack is 268 // Cache of images created in BuildFromExtension(). Once the theme pack is
269 // created, this cache should only be accessed on the file thread. There 269 // created, this cache should only be accessed on the file thread. There
270 // should be no IDs in |image_memory_| that are in |images_on_file_thread_| 270 // should be no IDs in |image_memory_| that are in |images_on_file_thread_|
271 // or vice versa. 271 // or vice versa.
272 ImageCache images_on_file_thread_; 272 ImageCache images_on_file_thread_;
273 273
274 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack); 274 DISALLOW_COPY_AND_ASSIGN(BrowserThemePack);
275 }; 275 };
276 276
277 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_ 277 #endif // CHROME_BROWSER_THEMES_BROWSER_THEME_PACK_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/font_settings/font_settings_api.cc ('k') | chrome/browser/themes/browser_theme_pack.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698