summaryrefslogtreecommitdiffstats
path: root/webkit/support
diff options
context:
space:
mode:
authorxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-04 16:15:17 +0000
committerxiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-04 16:15:17 +0000
commit8009f23dff4aeea8b2a1b32481ffbfbb334760c5 (patch)
treec6042d4cb63f05bfd29005f97ca592a0ed44c559 /webkit/support
parent81bb1092f354f3cb3c597ab3c9ed568905078e49 (diff)
downloadchromium_src-8009f23dff4aeea8b2a1b32481ffbfbb334760c5.zip
chromium_src-8009f23dff4aeea8b2a1b32481ffbfbb334760c5.tar.gz
chromium_src-8009f23dff4aeea8b2a1b32481ffbfbb334760c5.tar.bz2
Use ResourceBundle for NativeThemeLinux/Chromeos resource images.
- Clean up gfx NativeThemeLinux/Chromeos code to use ResourceBundle. This should also fix valgrind failures in issue 77712 and 77721. - Remove no longer needed gfx_module and gfx_resource_provider files. - Update linux/chromeos test_shell and DumpRenderTree to use ResourceBundle as well. BUG=77712,77721 TEST=Build should pass and valgrind failure in issue 77712 and 77721 should be gone. Review URL: http://codereview.chromium.org/6773021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r--webkit/support/platform_support_gtk.cc40
1 files changed, 8 insertions, 32 deletions
diff --git a/webkit/support/platform_support_gtk.cc b/webkit/support/platform_support_gtk.cc
index 41b144c..b315958 100644
--- a/webkit/support/platform_support_gtk.cc
+++ b/webkit/support/platform_support_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -11,22 +11,7 @@
#include "base/string16.h"
#include "base/string_piece.h"
#include "grit/webkit_resources.h"
-#include "ui/base/resource/data_pack.h"
-#include "ui/gfx/gfx_module.h"
-
-namespace {
-
-// Data resources on linux. This is a pointer to the mmapped resources file.
-ui::DataPack* g_resource_data_pack = NULL;
-
-base::StringPiece TestResourceProvider(int resource_id) {
- base::StringPiece res;
- if (g_resource_data_pack)
- g_resource_data_pack->GetStringPiece(resource_id, &res);
- return res;
-}
-
-}
+#include "ui/base/resource/resource_bundle.h"
namespace webkit_support {
@@ -39,18 +24,15 @@ void BeforeInitialize(bool unit_test_mode) {
void AfterInitialize(bool unit_test_mode) {
if (unit_test_mode)
return; // We don't have a resource pack when running the unit-tests.
- g_resource_data_pack = new ui::DataPack;
+
FilePath data_path;
PathService::Get(base::DIR_EXE, &data_path);
data_path = data_path.Append("DumpRenderTree.pak");
- if (!g_resource_data_pack->Load(data_path))
- LOG(FATAL) << "failed to load DumpRenderTree.pak";
-
- // Config the modules that need access to a limited set of resources.
- gfx::GfxModule::SetResourceProvider(TestResourceProvider);
+ ResourceBundle::InitSharedInstanceForTest(data_path);
}
void BeforeShutdown() {
+ ResourceBundle::CleanupSharedInstance();
}
void AfterShutdown() {
@@ -61,12 +43,7 @@ void AfterShutdown() {
namespace webkit_glue {
string16 GetLocalizedString(int message_id) {
- base::StringPiece res;
- if (!g_resource_data_pack->GetStringPiece(message_id, &res))
- LOG(FATAL) << "failed to load webkit string with id " << message_id;
-
- return string16(reinterpret_cast<const char16*>(res.data()),
- res.length() / 2);
+ return ResourceBundle::GetSharedInstance().GetLocalizedString(message_id);
}
base::StringPiece GetDataResource(int resource_id) {
@@ -95,9 +72,8 @@ base::StringPiece GetDataResource(int resource_id) {
return resize_corner_data;
}
}
- base::StringPiece res;
- g_resource_data_pack->GetStringPiece(resource_id, &res);
- return res;
+
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
} // namespace webkit_glue