Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index 93ce9fb58dc8125e3ca5c091fab3de9adb2db186..788e852bed8a0d54fe9500c7ffb30784b7c8b3eb 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -157,22 +157,34 @@ class RenderViewZoomer : public content::RenderViewVisitor { |
| DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); |
| }; |
| -} // namespace |
| +std::string HostToCustomPage(const std::string& host) { |
| + if (host == "gmail.com") |
| + return ".gmail"; |
|
Charlie Reis
2012/08/16 16:22:56
I don't understand how you're defining host. What
marja
2012/08/21 15:21:15
Here we don't care about http vs. https. It would
|
| + if (host == "docs.google.com") |
| + return ".docs"; |
| + if (host == "plus.google.com") |
| + return ".plus"; |
| + return ""; |
| +} |
| -static void* CreateHistogram( |
| +std::string custom_host; |
| +void* CreateHistogram( |
| const char *name, int min, int max, size_t buckets) { |
| if (min <= 0) |
| min = 1; |
| base::Histogram* histogram = base::Histogram::FactoryGet( |
| - name, min, max, buckets, base::Histogram::kUmaTargetedHistogramFlag); |
| + std::string(name) + custom_host, min, max, buckets, |
| + base::Histogram::kUmaTargetedHistogramFlag); |
| return histogram; |
| } |
| -static void AddHistogramSample(void* hist, int sample) { |
| +void AddHistogramSample(void* hist, int sample) { |
| base::Histogram* histogram = static_cast<base::Histogram*>(hist); |
| histogram->Add(sample); |
| } |
| +} // namespace |
| + |
| RenderThreadImpl* RenderThreadImpl::current() { |
| return lazy_tls.Pointer()->Get(); |
| } |
| @@ -779,6 +791,20 @@ RenderThreadImpl::GetAudioRendererMixerManager() { |
| return audio_renderer_mixer_manager_.get(); |
| } |
| +// static |
| +std::string RenderThreadImpl::CommonHost() { |
| + return custom_host; |
| +} |
| + |
| +// static |
| +void RenderThreadImpl::SetCommonHost(const std::string& host) { |
| + std::string new_custom_host = HostToCustomPage(host); |
| + if (new_custom_host != custom_host) { |
| + v8::V8::SetCreateHistogramFunction(CreateHistogram); |
| + custom_host = new_custom_host; |
| + } |
| +} |
| + |
| #if defined(OS_WIN) |
| void RenderThreadImpl::PreCacheFont(const LOGFONT& log_font) { |
| Send(new ChildProcessHostMsg_PreCacheFont(log_font)); |