summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.gyp1
-rw-r--r--base/base64.cc4
-rw-r--r--base/base64.h5
-rw-r--r--base/memory/ref_counted_memory.cc34
-rw-r--r--base/memory/ref_counted_memory.h51
-rw-r--r--base/memory/ref_counted_memory_unittest.cc45
-rw-r--r--chrome/browser/browser_about_handler.cc6
-rw-r--r--chrome/browser/browser_signin.cc6
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc14
-rw-r--r--chrome/browser/favicon/favicon_handler_unittest.cc10
-rw-r--r--chrome/browser/history/history_backend.cc10
-rw-r--r--chrome/browser/history/top_sites.cc5
-rw-r--r--chrome/browser/history/top_sites_unittest.cc10
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_setup_source.cc9
-rw-r--r--chrome/browser/printing/print_preview_message_handler.cc11
-rw-r--r--chrome/browser/ui/webui/bug_report_ui.cc9
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_data_source.cc5
-rw-r--r--chrome/browser/ui/webui/extension_icon_source.cc8
-rw-r--r--chrome/browser/ui/webui/fileicon_source.cc4
-rw-r--r--chrome/browser/ui/webui/gpu_internals_ui.cc6
-rw-r--r--chrome/browser/ui/webui/history2_ui.cc9
-rw-r--r--chrome/browser/ui/webui/media/media_internals_ui.cc6
-rw-r--r--chrome/browser/ui/webui/net_internals_ui.cc12
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui.cc2
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_resource_cache.cc23
-rw-r--r--chrome/browser/ui/webui/ntp/ntp_resource_cache.h14
-rw-r--r--chrome/browser/ui/webui/options/options_ui.cc29
-rw-r--r--chrome/browser/ui/webui/print_preview_data_source.cc8
-rw-r--r--chrome/browser/ui/webui/sessions_ui.cc8
-rw-r--r--chrome/browser/ui/webui/sync_internals_html_source.cc7
-rw-r--r--chrome/browser/ui/webui/task_manager_ui.cc8
-rw-r--r--chrome/browser/ui/webui/textfields_ui.cc8
-rw-r--r--chrome/browser/ui/webui/theme_source.h4
-rw-r--r--chrome/browser/ui/webui/workers_ui.cc6
-rw-r--r--content/renderer/render_widget_browsertest.cc2
35 files changed, 190 insertions, 209 deletions
diff --git a/base/base.gyp b/base/base.gyp
index d952161..6a7cfd4 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -144,7 +144,6 @@
'md5_unittest.cc',
'memory/linked_ptr_unittest.cc',
'memory/mru_cache_unittest.cc',
- 'memory/ref_counted_memory_unittest.cc',
'memory/ref_counted_unittest.cc',
'memory/scoped_ptr_unittest.cc',
'memory/scoped_vector_unittest.cc',
diff --git a/base/base64.cc b/base/base64.cc
index 62bd12d..56a577d 100644
--- a/base/base64.cc
+++ b/base/base64.cc
@@ -8,7 +8,7 @@
namespace base {
-bool Base64Encode(const StringPiece& input, std::string* output) {
+bool Base64Encode(const std::string& input, std::string* output) {
std::string temp;
temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte
@@ -23,7 +23,7 @@ bool Base64Encode(const StringPiece& input, std::string* output) {
return true;
}
-bool Base64Decode(const StringPiece& input, std::string* output) {
+bool Base64Decode(const std::string& input, std::string* output) {
std::string temp;
temp.resize(modp_b64_decode_len(input.size()));
diff --git a/base/base64.h b/base/base64.h
index e966ea7..294fb83 100644
--- a/base/base64.h
+++ b/base/base64.h
@@ -9,17 +9,16 @@
#include <string>
#include "base/base_api.h"
-#include "base/string_piece.h"
namespace base {
// Encodes the input string in base64. Returns true if successful and false
// otherwise. The output string is only modified if successful.
-BASE_API bool Base64Encode(const StringPiece& input, std::string* output);
+BASE_API bool Base64Encode(const std::string& input, std::string* output);
// Decodes the base64 input string. Returns true if successful and false
// otherwise. The output string is only modified if successful.
-BASE_API bool Base64Decode(const StringPiece& input, std::string* output);
+BASE_API bool Base64Decode(const std::string& input, std::string* output);
} // namespace base
diff --git a/base/memory/ref_counted_memory.cc b/base/memory/ref_counted_memory.cc
index 7e034f9..aa16031 100644
--- a/base/memory/ref_counted_memory.cc
+++ b/base/memory/ref_counted_memory.cc
@@ -4,8 +4,6 @@
#include "base/memory/ref_counted_memory.h"
-#include "base/logging.h"
-
RefCountedMemory::RefCountedMemory() {
}
@@ -24,49 +22,25 @@ RefCountedBytes::RefCountedBytes() {
}
RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer)
- : data_(initializer) {
+ : data(initializer) {
}
RefCountedBytes* RefCountedBytes::TakeVector(
std::vector<unsigned char>* to_destroy) {
RefCountedBytes* bytes = new RefCountedBytes;
- bytes->data_.swap(*to_destroy);
+ bytes->data.swap(*to_destroy);
return bytes;
}
const unsigned char* RefCountedBytes::front() const {
// STL will assert if we do front() on an empty vector, but calling code
// expects a NULL.
- return size() ? &data_.front() : NULL;
+ return size() ? &data.front() : NULL;
}
size_t RefCountedBytes::size() const {
- return data_.size();
+ return data.size();
}
RefCountedBytes::~RefCountedBytes() {
}
-
-namespace base {
-
-RefCountedString::RefCountedString() {}
-
-RefCountedString::~RefCountedString() {}
-
-// static
-RefCountedString* RefCountedString::TakeString(std::string* to_destroy) {
- RefCountedString* self = new RefCountedString;
- to_destroy->swap(self->data_);
- return self;
-}
-
-const unsigned char* RefCountedString::front() const {
- return data_.empty() ? NULL :
- reinterpret_cast<const unsigned char*>(data_.data());
-}
-
-size_t RefCountedString::size() const {
- return data_.size();
-}
-
-} // namespace base
diff --git a/base/memory/ref_counted_memory.h b/base/memory/ref_counted_memory.h
index 0d48f64..1a0f51ee 100644
--- a/base/memory/ref_counted_memory.h
+++ b/base/memory/ref_counted_memory.h
@@ -6,11 +6,9 @@
#define BASE_MEMORY_REF_COUNTED_MEMORY_H_
#pragma once
-#include <string>
#include <vector>
#include "base/base_api.h"
-#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
// TODO(erg): The contents of this file should be in a namespace. This would
@@ -42,9 +40,9 @@ class BASE_API RefCountedStaticMemory : public RefCountedMemory {
RefCountedStaticMemory()
: data_(NULL), length_(0) {}
RefCountedStaticMemory(const unsigned char* data, size_t length)
- : data_(length ? data : NULL), length_(length) {}
+ : data_(data), length_(length) {}
- // Overridden from RefCountedMemory:
+ // Overriden from RefCountedMemory:
virtual const unsigned char* front() const;
virtual size_t size() const;
@@ -69,51 +67,18 @@ class BASE_API RefCountedBytes : public RefCountedMemory {
// vector.)
static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy);
- // Overridden from RefCountedMemory:
- virtual const unsigned char* front() const OVERRIDE;
- virtual size_t size() const OVERRIDE;
+ // Overriden from RefCountedMemory:
+ virtual const unsigned char* front() const;
+ virtual size_t size() const;
- const std::vector<unsigned char>& data() const { return data_; }
- std::vector<unsigned char>& data() { return data_; }
+ std::vector<unsigned char> data;
- private:
+ protected:
friend class base::RefCountedThreadSafe<RefCountedBytes>;
virtual ~RefCountedBytes();
- std::vector<unsigned char> data_;
-
- DISALLOW_COPY_AND_ASSIGN(RefCountedBytes);
-};
-
-namespace base {
-
-// An implementation of RefCountedMemory, where the bytes are stored in an STL
-// string. Use this if your data naturally arrives in that format.
-class BASE_API RefCountedString : public RefCountedMemory {
- public:
- RefCountedString();
-
- // Constructs a RefCountedString object by performing a swap. (To non
- // destructively build a RefCountedString, use the default constructor and
- // copy into object->data()).
- static RefCountedString* TakeString(std::string* to_destroy);
-
- // Overridden from RefCountedMemory:
- virtual const unsigned char* front() const OVERRIDE;
- virtual size_t size() const OVERRIDE;
-
- const std::string& data() const { return data_; }
- std::string& data() { return data_; }
-
private:
- friend class base::RefCountedThreadSafe<RefCountedString>;
- virtual ~RefCountedString();
-
- std::string data_;
-
- DISALLOW_COPY_AND_ASSIGN(RefCountedString);
+ DISALLOW_COPY_AND_ASSIGN(RefCountedBytes);
};
-} // namespace base
-
#endif // BASE_MEMORY_REF_COUNTED_MEMORY_H_
diff --git a/base/memory/ref_counted_memory_unittest.cc b/base/memory/ref_counted_memory_unittest.cc
deleted file mode 100644
index 1936040..0000000
--- a/base/memory/ref_counted_memory_unittest.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-#include "base/memory/ref_counted_memory.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace base {
-
-TEST(RefCountedMemoryUnitTest, RefCountedStaticMemory) {
- scoped_refptr<RefCountedMemory> mem = new RefCountedStaticMemory(
- reinterpret_cast<const uint8*>("static mem00"), 10);
-
- EXPECT_EQ(10U, mem->size());
- EXPECT_EQ("static mem",
- std::string(reinterpret_cast<const char*>(mem->front()),
- mem->size()));
-}
-
-TEST(RefCountedMemoryUnitTest, RefCountedBytes) {
- std::vector<uint8> data;
- data.push_back(45);
- data.push_back(99);
- scoped_refptr<RefCountedMemory> mem = RefCountedBytes::TakeVector(&data);
-
- EXPECT_EQ(0U, data.size());
-
- EXPECT_EQ(2U, mem->size());
- EXPECT_EQ(45U, mem->front()[0]);
- EXPECT_EQ(99U, mem->front()[1]);
-}
-
-TEST(RefCountedMemoryUnitTest, RefCountedString) {
- std::string s("destroy me");
- scoped_refptr<RefCountedMemory> mem = RefCountedString::TakeString(&s);
-
- EXPECT_EQ(0U, s.size());
-
- EXPECT_EQ(10U, mem->size());
- EXPECT_EQ('d', mem->front()[0]);
- EXPECT_EQ('e', mem->front()[1]);
-}
-
-} // namespace base
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index f8cfcbf..95785ff 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -1421,8 +1421,10 @@ void AboutSource::StartDataRequest(const std::string& path,
}
void AboutSource::FinishDataRequest(const std::string& html, int request_id) {
- std::string html_copy(html);
- SendResponse(request_id, base::RefCountedString::TakeString(&html_copy));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(html.size());
+ std::copy(html.begin(), html.end(), html_bytes->data.begin());
+ SendResponse(request_id, html_bytes);
}
std::string AboutSource::GetMimeType(const std::string& path) const {
diff --git a/chrome/browser/browser_signin.cc b/chrome/browser/browser_signin.cc
index 8f4bbd61..ec1a0fb 100644
--- a/chrome/browser/browser_signin.cc
+++ b/chrome/browser/browser_signin.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/browser_signin.h"
+#include <algorithm>
#include <string>
#include <vector>
@@ -67,7 +68,10 @@ void BrowserSigninResourcesSource::StartDataRequest(const std::string& path,
response = jstemplate_builder::GetI18nTemplateHtml(html, &dict);
}
- SendResponse(request_id, base::RefCountedString::TakeString(&response));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(response.size());
+ std::copy(response.begin(), response.end(), html_bytes->data.begin());
+ SendResponse(request_id, html_bytes);
}
class BrowserSigninHtml : public HtmlDialogUIDelegate,
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index e5f7fd5..e1f0361 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -9,7 +9,6 @@
#include "base/base64.h"
#include "base/memory/ref_counted_memory.h"
-#include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -1264,7 +1263,7 @@ void CaptureVisibleTabFunction::Observe(int type,
// and call SendResponse().
void CaptureVisibleTabFunction::SendResultFromBitmap(
const SkBitmap& screen_capture) {
- std::vector<unsigned char> data;
+ scoped_refptr<RefCountedBytes> image_data(new RefCountedBytes);
SkAutoLockPixels screen_capture_lock(screen_capture);
bool encoded = false;
std::string mime_type;
@@ -1277,14 +1276,14 @@ void CaptureVisibleTabFunction::SendResultFromBitmap(
screen_capture.height(),
static_cast<int>(screen_capture.rowBytes()),
image_quality_,
- &data);
+ &image_data->data);
mime_type = keys::kMimeTypeJpeg;
break;
case FORMAT_PNG:
encoded = gfx::PNGCodec::EncodeBGRASkBitmap(
screen_capture,
true, // Discard transparency.
- &data);
+ &image_data->data);
mime_type = keys::kMimeTypePng;
break;
default:
@@ -1298,8 +1297,11 @@ void CaptureVisibleTabFunction::SendResultFromBitmap(
}
std::string base64_result;
- base::StringPiece stream_as_string(
- reinterpret_cast<const char*>(vector_as_array(&data)), data.size());
+ std::string stream_as_string;
+ stream_as_string.resize(image_data->data.size());
+ memcpy(&stream_as_string[0],
+ reinterpret_cast<const char*>(&image_data->data[0]),
+ image_data->data.size());
base::Base64Encode(stream_as_string, &base64_result);
base64_result.insert(0, base::StringPrintf("data:%s;base64,",
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc
index a76192d..c2cc69a 100644
--- a/chrome/browser/favicon/favicon_handler_unittest.cc
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -329,7 +329,7 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) {
history_handler->favicon_data_.expired = false;
history_handler->favicon_data_.icon_url = icon_url;
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
- FillBitmap(kFaviconSize, kFaviconSize, &data->data());
+ FillBitmap(kFaviconSize, kFaviconSize, &data->data);
history_handler->favicon_data_.image_data = data;
// Send history response.
@@ -442,7 +442,7 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) {
history_handler->favicon_data_.expired = false;
history_handler->favicon_data_.icon_url = icon_url;
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
- FillBitmap(kFaviconSize, kFaviconSize, &data->data());
+ FillBitmap(kFaviconSize, kFaviconSize, &data->data);
history_handler->favicon_data_.image_data = data;
// Send history response.
@@ -529,7 +529,7 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) {
history_handler->favicon_data_.expired = false;
history_handler->favicon_data_.icon_url = icon_url;
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
- FillBitmap(kFaviconSize, kFaviconSize, &data->data());
+ FillBitmap(kFaviconSize, kFaviconSize, &data->data);
history_handler->favicon_data_.image_data = data;
// Send history response.
@@ -671,7 +671,7 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) {
history_handler->favicon_data_.expired = true;
history_handler->favicon_data_.icon_url = new_icon_url;
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
- FillBitmap(kFaviconSize, kFaviconSize, &data->data());
+ FillBitmap(kFaviconSize, kFaviconSize, &data->data);
history_handler->favicon_data_.image_data = data;
history_handler->InvokeCallback();
@@ -800,7 +800,7 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) {
handler->favicon_data_.icon_type = history::TOUCH_ICON;
handler->favicon_data_.icon_url = latest_icon_url;
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
- FillBitmap(kFaviconSize, kFaviconSize, &data->data());
+ FillBitmap(kFaviconSize, kFaviconSize, &data->data);
handler->favicon_data_.image_data = data;
handler->InvokeCallback();
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 0da92cc..5da8424 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -1511,19 +1511,19 @@ void HistoryBackend::GetPageThumbnailDirectly(
if (GetMostRecentRedirectsFrom(page_url, &redirects) &&
!redirects.empty()) {
if ((url_id = db_->GetRowForURL(redirects.back(), NULL)))
- success = thumbnail_db_->GetPageThumbnail(url_id, &(*data)->data());
+ success = thumbnail_db_->GetPageThumbnail(url_id, &(*data)->data);
}
// If we don't have a thumbnail from redirects, try the URL directly.
if (!success) {
if ((url_id = db_->GetRowForURL(page_url, NULL)))
- success = thumbnail_db_->GetPageThumbnail(url_id, &(*data)->data());
+ success = thumbnail_db_->GetPageThumbnail(url_id, &(*data)->data);
}
// In this rare case, we start to mine the older redirect sessions
// from the visit table to try to find a thumbnail.
if (!success) {
- success = GetThumbnailFromOlderRedirect(page_url, &(*data)->data());
+ success = GetThumbnailFromOlderRedirect(page_url, &(*data)->data);
}
if (!success)
@@ -1693,7 +1693,7 @@ void HistoryBackend::UpdateFaviconMappingAndFetchImpl(
scoped_refptr<RefCountedBytes> data = new RefCountedBytes();
favicon.known_icon = true;
Time last_updated;
- if (thumbnail_db_->GetFavicon(favicon_id, &last_updated, &data->data(),
+ if (thumbnail_db_->GetFavicon(favicon_id, &last_updated, &data->data,
NULL)) {
favicon.expired = (Time::Now() - last_updated) >
TimeDelta::FromDays(kFaviconRefetchDays);
@@ -1729,7 +1729,7 @@ void HistoryBackend::GetFaviconForURL(
if (thumbnail_db_->GetIconMappingsForPageURL(page_url, &icon_mappings) &&
(icon_mappings.front().icon_type & icon_types) &&
thumbnail_db_->GetFavicon(icon_mappings.front().icon_id, &last_updated,
- &data->data(), &favicon.icon_url)) {
+ &data->data, &favicon.icon_url)) {
favicon.known_icon = true;
favicon.expired = (Time::Now() - last_updated) >
TimeDelta::FromDays(kFaviconRefetchDays);
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index efd2f8d..1c6f67f 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -605,9 +605,8 @@ bool TopSites::EncodeBitmap(const SkBitmap& bitmap,
return false;
}
// As we're going to cache this data, make sure the vector is only as big as
- // it needs to be, as JPEGCodec::Encode() over-allocates data.capacity().
- // (In a C++0x future, we can just call shrink_to_fit() in Encode())
- (*bytes)->data() = data;
+ // it needs to be.
+ (*bytes)->data = data;
return true;
}
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index 3ddbfca..ee487c32 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -108,7 +108,7 @@ class TopSitesQuerier {
// thumbnail data, which is stored as jpgs.
SkBitmap ExtractThumbnail(const RefCountedBytes& t1) {
scoped_ptr<SkBitmap> image(gfx::JPEGCodec::Decode(t1.front(),
- t1.size()));
+ t1.data.size()));
return image.get() ? *image : SkBitmap();
}
@@ -116,11 +116,11 @@ SkBitmap ExtractThumbnail(const RefCountedBytes& t1) {
bool ThumbnailsAreEqual(RefCountedBytes* t1, RefCountedBytes* t2) {
if (!t1 || !t2)
return false;
- if (t1->size() != t2->size())
+ if (t1->data.size() != t2->data.size())
return false;
- return std::equal(t1->data().begin(),
- t1->data().end(),
- t2->data().begin());
+ return std::equal(t1->data.begin(),
+ t1->data.end(),
+ t2->data.begin());
}
} // namespace
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc
index 06976db..4544ff80 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/printing/cloud_print/cloud_print_setup_source.h"
+#include <algorithm>
+
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -117,8 +119,11 @@ void CloudPrintSetupSource::StartDataRequest(const std::string& path_raw,
.GetRawDataResource(IDR_CLOUD_PRINT_SETUP_FLOW_HTML));
response = html.as_string();
}
-
- SendResponse(request_id, base::RefCountedString::TakeString(&response));
+ // Send the response.
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(response.size());
+ std::copy(response.begin(), response.end(), html_bytes->data.begin());
+ SendResponse(request_id, html_bytes);
}
std::string CloudPrintSetupSource::GetMimeType(const std::string& path) const {
diff --git a/chrome/browser/printing/print_preview_message_handler.cc b/chrome/browser/printing/print_preview_message_handler.cc
index 75aa54c..99be3f5 100644
--- a/chrome/browser/printing/print_preview_message_handler.cc
+++ b/chrome/browser/printing/print_preview_message_handler.cc
@@ -141,15 +141,14 @@ void PrintPreviewMessageHandler::OnPagesReadyForPreview(
wrapper->print_view_manager()->OverrideTitle(tab_contents());
- const unsigned char* preview_data =
- static_cast<unsigned char*>(shared_buf->memory());
+ char* preview_data = static_cast<char*>(shared_buf->memory());
uint32 preview_data_size = params.data_size;
- // TODO(joth): This seems like a good match for using RefCountedStaticMemory
- // to avoid the memory copy, but the SetPrintPreviewData call chain below
- // needs updating to accept the RefCountedMemory* base class.
scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
- html_bytes->data().assign(preview_data, preview_data + preview_data_size);
+ html_bytes->data.resize(preview_data_size);
+ std::vector<unsigned char>::iterator it = html_bytes->data.begin();
+ for (uint32 i = 0; i < preview_data_size; ++i, ++it)
+ *it = *(preview_data + i);
print_preview_ui->SetPrintPreviewData(html_bytes.get());
print_preview_ui->OnPreviewDataIsAvailable(
diff --git a/chrome/browser/ui/webui/bug_report_ui.cc b/chrome/browser/ui/webui/bug_report_ui.cc
index 54a78a6..62c3ec8 100644
--- a/chrome/browser/ui/webui/bug_report_ui.cc
+++ b/chrome/browser/ui/webui/bug_report_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/bug_report_ui.h"
+#include <algorithm>
#include <vector>
#include "base/callback.h"
@@ -377,10 +378,14 @@ void BugReportUIHTMLSource::StartDataRequest(const std::string& path,
SetFontAndTextDirection(&localized_strings);
- std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
+ const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
bug_report_html_, &localized_strings);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
diff --git a/chrome/browser/ui/webui/chrome_web_ui_data_source.cc b/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
index e4ca9b1..4f74f51 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
@@ -54,9 +54,12 @@ void ChromeWebUIDataSource::StartDataRequest(const std::string& path,
void ChromeWebUIDataSource::SendLocalizedStringsAsJSON(int request_id) {
std::string template_data;
+ scoped_refptr<RefCountedBytes> response(new RefCountedBytes);
SetFontAndTextDirection(&localized_strings_);
jstemplate_builder::AppendJsonJS(&localized_strings_, &template_data);
- SendResponse(request_id, base::RefCountedString::TakeString(&template_data));
+ response->data.resize(template_data.size());
+ std::copy(template_data.begin(), template_data.end(),response->data.begin());
+ SendResponse(request_id, response);
}
void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) {
diff --git a/chrome/browser/ui/webui/extension_icon_source.cc b/chrome/browser/ui/webui/extension_icon_source.cc
index 78c7b27..b38c273 100644
--- a/chrome/browser/ui/webui/extension_icon_source.cc
+++ b/chrome/browser/ui/webui/extension_icon_source.cc
@@ -31,8 +31,12 @@
namespace {
scoped_refptr<RefCountedMemory> BitmapToMemory(SkBitmap* image) {
- RefCountedBytes* image_bytes = new RefCountedBytes;
- gfx::PNGCodec::EncodeBGRASkBitmap(*image, false, &image_bytes->data());
+ std::vector<unsigned char> output;
+ gfx::PNGCodec::EncodeBGRASkBitmap(*image, false, &output);
+
+ scoped_refptr<RefCountedBytes> image_bytes(new RefCountedBytes);
+ image_bytes->data.resize(output.size());
+ std::copy(output.begin(), output.end(), image_bytes->data.begin());
return image_bytes;
}
diff --git a/chrome/browser/ui/webui/fileicon_source.cc b/chrome/browser/ui/webui/fileicon_source.cc
index cd5d936..94301af 100644
--- a/chrome/browser/ui/webui/fileicon_source.cc
+++ b/chrome/browser/ui/webui/fileicon_source.cc
@@ -45,7 +45,7 @@ void FileIconSource::StartDataRequest(const std::string& path,
if (icon) {
scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes);
- gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data());
+ gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data);
SendResponse(request_id, icon_data);
} else {
@@ -72,7 +72,7 @@ void FileIconSource::OnFileIconDataAvailable(IconManager::Handle handle,
if (icon) {
scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes);
- gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data());
+ gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data);
SendResponse(request_id, icon_data);
} else {
diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc
index 36ae3cc..ba902f9 100644
--- a/chrome/browser/ui/webui/gpu_internals_ui.cc
+++ b/chrome/browser/ui/webui/gpu_internals_ui.cc
@@ -175,7 +175,11 @@ void GpuHTMLSource::StartDataRequest(const std::string& path,
jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
std::string GpuHTMLSource::GetMimeType(const std::string&) const {
diff --git a/chrome/browser/ui/webui/history2_ui.cc b/chrome/browser/ui/webui/history2_ui.cc
index 4e5fc27..ab9385c 100644
--- a/chrome/browser/ui/webui/history2_ui.cc
+++ b/chrome/browser/ui/webui/history2_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/webui/history2_ui.h"
+#include <algorithm>
#include <set>
#include "base/callback.h"
@@ -100,10 +101,14 @@ void HistoryUIHTMLSource2::StartDataRequest(const std::string& path,
static const base::StringPiece history_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_HISTORY2_HTML));
- std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
+ const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
history_html, &localized_strings);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
std::string HistoryUIHTMLSource2::GetMimeType(const std::string&) const {
diff --git a/chrome/browser/ui/webui/media/media_internals_ui.cc b/chrome/browser/ui/webui/media/media_internals_ui.cc
index b794ff9..6fc0229 100644
--- a/chrome/browser/ui/webui/media/media_internals_ui.cc
+++ b/chrome/browser/ui/webui/media/media_internals_ui.cc
@@ -57,7 +57,11 @@ void MediaInternalsHTMLSource::StartDataRequest(const std::string& path,
jstemplate_builder::AppendJsonHtml(&localized_strings, &html);
jstemplate_builder::AppendI18nTemplateProcessHtml(&html);
- SendResponse(request_id, base::RefCountedString::TakeString(&html));
+ scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes());
+ bytes->data.resize(html.size());
+ std::copy(html.begin(), html.end(), bytes->data.begin());
+
+ SendResponse(request_id, bytes);
}
std::string MediaInternalsHTMLSource::GetMimeType(
diff --git a/chrome/browser/ui/webui/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals_ui.cc
index 69a9261..a742d02 100644
--- a/chrome/browser/ui/webui/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals_ui.cc
@@ -483,13 +483,19 @@ void NetInternalsHTMLSource::StartDataRequest(const std::string& path,
jstemplate_builder::AppendI18nTemplateProcessHtml(&full_html);
jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+ SendResponse(request_id, html_bytes);
return;
}
- std::string data_string("<p style='color:red'>Failed to read resource" +
+ const std::string data_string("<p style='color:red'>Failed to read resource" +
EscapeForHTML(filename) + "</p>");
- SendResponse(request_id, base::RefCountedString::TakeString(&data_string));
+ scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes);
+ bytes->data.resize(data_string.size());
+ std::copy(data_string.begin(), data_string.end(), bytes->data.begin());
+ SendResponse(request_id, bytes);
}
std::string NetInternalsHTMLSource::GetMimeType(const std::string&) const {
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 72fad9f..ba8d666 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -446,7 +446,7 @@ void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path,
return;
}
- scoped_refptr<RefCountedMemory> html_bytes(
+ scoped_refptr<RefCountedBytes> html_bytes(
NTPResourceCacheFactory::GetForProfile(profile_)->
GetNewTabHTML(is_incognito));
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index 91f2bf6..bc47129 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -171,7 +171,7 @@ NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {
NTPResourceCache::~NTPResourceCache() {}
-RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
+RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_incognito) {
if (!new_tab_incognito_html_.get())
@@ -184,7 +184,7 @@ RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
: new_tab_html_.get();
}
-RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
+RefCountedBytes* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (is_incognito) {
if (!new_tab_incognito_css_.get())
@@ -259,7 +259,10 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() {
std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
incognito_tab_html, &localized_strings);
- new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
+ new_tab_incognito_html_ = new RefCountedBytes;
+ new_tab_incognito_html_->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(),
+ new_tab_incognito_html_->data.begin());
}
void NTPResourceCache::CreateNewTabHTML() {
@@ -434,7 +437,9 @@ void NTPResourceCache::CreateNewTabHTML() {
}
}
- new_tab_html_ = base::RefCountedString::TakeString(&full_html);
+ new_tab_html_ = new RefCountedBytes;
+ new_tab_html_->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), new_tab_html_->data.begin());
}
void NTPResourceCache::CreateNewTabIncognitoCSS() {
@@ -467,7 +472,10 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() {
std::string full_css = ReplaceStringPlaceholders(
new_tab_theme_css, subst, NULL);
- new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css);
+ new_tab_incognito_css_ = new RefCountedBytes;
+ new_tab_incognito_css_->data.resize(full_css.size());
+ std::copy(full_css.begin(), full_css.end(),
+ new_tab_incognito_css_->data.begin());
}
void NTPResourceCache::CreateNewTabCSS() {
@@ -562,5 +570,8 @@ void NTPResourceCache::CreateNewTabCSS() {
// Create the string from our template and the replacements.
std::string css_string;
css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
- new_tab_css_ = base::RefCountedString::TakeString(&css_string);
+ new_tab_css_ = new RefCountedBytes;
+ new_tab_css_->data.resize(css_string.size());
+ std::copy(css_string.begin(), css_string.end(),
+ new_tab_css_->data.begin());
}
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
index 67be6fc..c4a10e0 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
@@ -14,7 +14,7 @@
#include "content/common/notification_registrar.h"
class Profile;
-class RefCountedMemory;
+class RefCountedBytes;
// This class keeps a cache of NTP resources (HTML and CSS) so we don't have to
// regenerate them all the time.
@@ -24,8 +24,8 @@ class NTPResourceCache : public NotificationObserver,
explicit NTPResourceCache(Profile* profile);
virtual ~NTPResourceCache();
- RefCountedMemory* GetNewTabHTML(bool is_incognito);
- RefCountedMemory* GetNewTabCSS(bool is_incognito);
+ RefCountedBytes* GetNewTabHTML(bool is_incognito);
+ RefCountedBytes* GetNewTabCSS(bool is_incognito);
// NotificationObserver interface.
virtual void Observe(int type,
@@ -36,14 +36,14 @@ class NTPResourceCache : public NotificationObserver,
Profile* profile_;
void CreateNewTabIncognitoHTML();
- scoped_refptr<RefCountedMemory> new_tab_incognito_html_;
+ scoped_refptr<RefCountedBytes> new_tab_incognito_html_;
void CreateNewTabHTML();
- scoped_refptr<RefCountedMemory> new_tab_html_;
+ scoped_refptr<RefCountedBytes> new_tab_html_;
void CreateNewTabIncognitoCSS();
- scoped_refptr<RefCountedMemory> new_tab_incognito_css_;
+ scoped_refptr<RefCountedBytes> new_tab_incognito_css_;
void CreateNewTabCSS();
- scoped_refptr<RefCountedMemory> new_tab_css_;
+ scoped_refptr<RefCountedBytes> new_tab_css_;
NotificationRegistrar registrar_;
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc
index 0446103..538bf41 100644
--- a/chrome/browser/ui/webui/options/options_ui.cc
+++ b/chrome/browser/ui/webui/options/options_ui.cc
@@ -115,22 +115,35 @@ OptionsUIHTMLSource::~OptionsUIHTMLSource() {}
void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
bool is_incognito,
int request_id) {
- scoped_refptr<RefCountedMemory> response_bytes;
+ scoped_refptr<RefCountedBytes> response_bytes(new RefCountedBytes);
SetFontAndTextDirection(localized_strings_.get());
if (path == kLocalizedStringsFile) {
// Return dynamically-generated strings from memory.
- std::string strings_js;
- jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js);
- response_bytes = base::RefCountedString::TakeString(&strings_js);
+ std::string template_data;
+ jstemplate_builder::AppendJsonJS(localized_strings_.get(), &template_data);
+ response_bytes->data.resize(template_data.size());
+ std::copy(template_data.begin(),
+ template_data.end(),
+ response_bytes->data.begin());
} else if (path == kOptionsBundleJsFile) {
// Return (and cache) the options javascript code.
- response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- IDR_OPTIONS_BUNDLE_JS);
+ static const base::StringPiece options_javascript(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_OPTIONS_BUNDLE_JS));
+ response_bytes->data.resize(options_javascript.size());
+ std::copy(options_javascript.begin(),
+ options_javascript.end(),
+ response_bytes->data.begin());
} else {
// Return (and cache) the main options html page as the default.
- response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- IDR_OPTIONS_HTML);
+ static const base::StringPiece options_html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_OPTIONS_HTML));
+ response_bytes->data.resize(options_html.size());
+ std::copy(options_html.begin(),
+ options_html.end(),
+ response_bytes->data.begin());
}
SendResponse(request_id, response_bytes);
diff --git a/chrome/browser/ui/webui/print_preview_data_source.cc b/chrome/browser/ui/webui/print_preview_data_source.cc
index 04399b2..8d01bbd 100644
--- a/chrome/browser/ui/webui/print_preview_data_source.cc
+++ b/chrome/browser/ui/webui/print_preview_data_source.cc
@@ -158,10 +158,14 @@ void PrintPreviewDataSource::StartDataRequest(const std::string& path,
static const base::StringPiece print_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PRINT_PREVIEW_HTML));
- std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
+ const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
print_html, &localized_strings);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
return;
} else if (preview_data_requested && data->front()) {
// Print Preview data.
diff --git a/chrome/browser/ui/webui/sessions_ui.cc b/chrome/browser/ui/webui/sessions_ui.cc
index 9d3d6c1..7b2ed5c 100644
--- a/chrome/browser/ui/webui/sessions_ui.cc
+++ b/chrome/browser/ui/webui/sessions_ui.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/ui/webui/sessions_ui.h"
-#include <algorithm>
-
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
@@ -79,7 +77,11 @@ void SessionsUIHTMLSource::StartDataRequest(const std::string& path,
&localized_strings);
jstemplate_builder::AppendJsTemplateSourceHtml(&full_html);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/ui/webui/sync_internals_html_source.cc b/chrome/browser/ui/webui/sync_internals_html_source.cc
index 6e5333c..c5c2809 100644
--- a/chrome/browser/ui/webui/sync_internals_html_source.cc
+++ b/chrome/browser/ui/webui/sync_internals_html_source.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webui/sync_internals_html_source.h"
+#include <algorithm>
+
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/message_loop.h"
@@ -35,7 +37,10 @@ void SyncInternalsHTMLSource::StartDataRequest(const std::string& path,
jstemplate_builder::AppendJsonHtml(&localized_strings, &html);
jstemplate_builder::AppendI18nTemplateProcessHtml(&html);
- SendResponse(request_id, base::RefCountedString::TakeString(&html));
+ scoped_refptr<RefCountedBytes> bytes(new RefCountedBytes());
+ bytes->data.resize(html.size());
+ std::copy(html.begin(), html.end(), bytes->data.begin());
+ SendResponse(request_id, bytes);
}
std::string SyncInternalsHTMLSource::GetMimeType(
diff --git a/chrome/browser/ui/webui/task_manager_ui.cc b/chrome/browser/ui/webui/task_manager_ui.cc
index ae33f06..5a4a316 100644
--- a/chrome/browser/ui/webui/task_manager_ui.cc
+++ b/chrome/browser/ui/webui/task_manager_ui.cc
@@ -85,10 +85,14 @@ void TaskManagerUIHTMLSource::StartDataRequest(const std::string& path,
static const base::StringPiece task_manager_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_TASK_MANAGER_HTML));
- std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
+ const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
task_manager_html, &localized_strings);
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
} // namespace
diff --git a/chrome/browser/ui/webui/textfields_ui.cc b/chrome/browser/ui/webui/textfields_ui.cc
index 3e4691e..819048e5 100644
--- a/chrome/browser/ui/webui/textfields_ui.cc
+++ b/chrome/browser/ui/webui/textfields_ui.cc
@@ -29,10 +29,14 @@ TextfieldsUIHTMLSource::TextfieldsUIHTMLSource()
void TextfieldsUIHTMLSource::StartDataRequest(const std::string& path,
bool is_incognito,
int request_id) {
- std::string full_html = ResourceBundle::GetSharedInstance()
+ const std::string full_html = ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_TEXTFIELDS_HTML).as_string();
- SendResponse(request_id, base::RefCountedString::TakeString(&full_html));
+ scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
+ html_bytes->data.resize(full_html.size());
+ std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
+
+ SendResponse(request_id, html_bytes);
}
std::string TextfieldsUIHTMLSource::GetMimeType(
diff --git a/chrome/browser/ui/webui/theme_source.h b/chrome/browser/ui/webui/theme_source.h
index ad49672..c3d8207 100644
--- a/chrome/browser/ui/webui/theme_source.h
+++ b/chrome/browser/ui/webui/theme_source.h
@@ -11,7 +11,7 @@
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
class Profile;
-class RefCountedMemory;
+class RefCountedBytes;
class ThemeSource : public ChromeURLDataManager::DataSource {
public:
@@ -40,7 +40,7 @@ class ThemeSource : public ChromeURLDataManager::DataSource {
Profile* profile_;
// We grab the CSS early so we don't have to go back to the UI thread later.
- scoped_refptr<RefCountedMemory> css_bytes_;
+ scoped_refptr<RefCountedBytes> css_bytes_;
DISALLOW_COPY_AND_ASSIGN(ThemeSource);
};
diff --git a/chrome/browser/ui/webui/workers_ui.cc b/chrome/browser/ui/webui/workers_ui.cc
index f2220a3..52cd620 100644
--- a/chrome/browser/ui/webui/workers_ui.cc
+++ b/chrome/browser/ui/webui/workers_ui.cc
@@ -101,7 +101,11 @@ void WorkersUIHTMLSource::SendSharedWorkersData(int request_id) {
std::string json_string;
base::JSONWriter::Write(&workers_list, false, &json_string);
- SendResponse(request_id, base::RefCountedString::TakeString(&json_string));
+ scoped_refptr<RefCountedBytes> json_bytes(new RefCountedBytes());
+ json_bytes->data.resize(json_string.size());
+ std::copy(json_string.begin(), json_string.end(), json_bytes->data.begin());
+
+ SendResponse(request_id, json_bytes);
}
class WorkersDOMHandler : public WebUIMessageHandler {
diff --git a/content/renderer/render_widget_browsertest.cc b/content/renderer/render_widget_browsertest.cc
index 51b0735..8483249 100644
--- a/content/renderer/render_widget_browsertest.cc
+++ b/content/renderer/render_widget_browsertest.cc
@@ -137,7 +137,7 @@ void RenderWidgetTest::OutputBitmapToFile(const SkBitmap& bitmap,
bitmap.height(),
static_cast<int>(bitmap.rowBytes()),
90 /* quality */,
- &bitmap_data->data()));
+ &bitmap_data->data));
ASSERT_LT(0, file_util::WriteFile(
file_path,
reinterpret_cast<const char*>(bitmap_data->front()),