Chromium Code Reviews| Index: ui/gfx/color_profile.cc |
| diff --git a/ui/gfx/color_profile.cc b/ui/gfx/color_profile.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ee087ca29ca100e8bd3b9de2a97b0d5cf2862c2b |
| --- /dev/null |
| +++ b/ui/gfx/color_profile.cc |
| @@ -0,0 +1,28 @@ |
| +// 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. |
| + |
| +#include "color_profile.h" |
| + |
| +#include "base/logging.h" |
| + |
| +namespace gfx { |
| + |
| +void ColorProfile::GetColorProfile(gfx::NativeViewId parent_window, |
| + std::vector<char>* profile) { |
| + // Called from the FILE thread on Windows and IO thread elsewhere. |
| + // Force data to leak so exit time destructors are not called. |
| + static std::map<gfx::NativeViewId, std::vector<char> >& data = |
| + *new std::map<gfx::NativeViewId, std::vector<char> >(); |
| + |
|
Noel Gordon
2012/06/21 16:58:33
You could add a DCHECK(!parent_window) here, becau
tpayne
2012/07/02 19:22:32
Done.
|
| + profile->clear(); |
| + std::vector<char> stored_profile; |
| + if (data.find(parent_window) == data.end()) { |
| + ReadProfile(parent_window, &stored_profile); |
| + data[parent_window] = stored_profile; |
| + } |
| + |
| + profile->assign(data[parent_window].begin(), data[parent_window].end()); |
| +} |
| + |
| +} // namespace gfx |