OLD | NEW |
---|---|
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 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
16 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
19 #include "base/json/json_writer.h" | 19 #include "base/json/json_writer.h" |
20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
22 #include "base/message_loop/message_loop_proxy.h" | 22 #include "base/message_loop/message_loop_proxy.h" |
23 #include "base/metrics/field_trial.h" | |
23 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
24 #include "base/path_service.h" | 25 #include "base/path_service.h" |
25 #include "base/process/kill.h" | 26 #include "base/process/kill.h" |
26 #include "base/process/process.h" | 27 #include "base/process/process.h" |
27 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/string_piece.h" | 29 #include "base/strings/string_piece.h" |
29 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
30 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
31 #include "base/strings/sys_string_conversions.h" | 32 #include "base/strings/sys_string_conversions.h" |
32 #include "base/strings/utf_string_conversions.h" | 33 #include "base/strings/utf_string_conversions.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 | 466 |
466 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) | 467 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) |
467 return false; | 468 return false; |
468 | 469 |
469 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) | 470 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) |
470 return true; | 471 return true; |
471 | 472 |
472 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 473 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
473 } | 474 } |
474 | 475 |
476 static bool ShouldUseExpandedHeuristicsForGpuRasterization() { | |
477 const char kGpuRasterizationContentWhitelistFieldTrialName[] = | |
478 "GpuRasterizationExpandedContentWhitelist"; | |
479 const char kGpuRasterizationContentWhitelistFieldTrialEnabledName[] = | |
480 "Enabled"; | |
481 | |
482 return base::FieldTrialList::FindFullName( | |
483 kGpuRasterizationContentWhitelistFieldTrialName) == | |
Alexei Svitkine (slow)
2014/06/04 18:05:09
Nit: I think it's cleaner without the extra consta
ajuma
2014/06/04 18:25:33
Done.
| |
484 kGpuRasterizationContentWhitelistFieldTrialEnabledName; | |
485 } | |
486 | |
475 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { | 487 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { |
476 switch (type) { | 488 switch (type) { |
477 case blink::WebIconURL::TypeFavicon: | 489 case blink::WebIconURL::TypeFavicon: |
478 return FaviconURL::FAVICON; | 490 return FaviconURL::FAVICON; |
479 case blink::WebIconURL::TypeTouch: | 491 case blink::WebIconURL::TypeTouch: |
480 return FaviconURL::TOUCH_ICON; | 492 return FaviconURL::TOUCH_ICON; |
481 case blink::WebIconURL::TypeTouchPrecomposed: | 493 case blink::WebIconURL::TypeTouchPrecomposed: |
482 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 494 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
483 case blink::WebIconURL::TypeInvalid: | 495 case blink::WebIconURL::TypeInvalid: |
484 return FaviconURL::INVALID_ICON; | 496 return FaviconURL::INVALID_ICON; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 756 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
745 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 757 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
746 webview()->settings()->setCompositorDrivenAcceleratedScrollingEnabled( | 758 webview()->settings()->setCompositorDrivenAcceleratedScrollingEnabled( |
747 ShouldUseUniversalAcceleratedCompositingForOverflowScroll()); | 759 ShouldUseUniversalAcceleratedCompositingForOverflowScroll()); |
748 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 760 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
749 ShouldUseTransitionCompositing(device_scale_factor_)); | 761 ShouldUseTransitionCompositing(device_scale_factor_)); |
750 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 762 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
751 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 763 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
752 webview()->settings()->setCompositedScrollingForFramesEnabled( | 764 webview()->settings()->setCompositedScrollingForFramesEnabled( |
753 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 765 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
766 webview()->settings()->setUseExpandedHeuristicsForGpuRasterization( | |
767 ShouldUseExpandedHeuristicsForGpuRasterization()); | |
754 | 768 |
755 ApplyWebPreferences(webkit_preferences_, webview()); | 769 ApplyWebPreferences(webkit_preferences_, webview()); |
756 | 770 |
757 webview()->settings()->setAllowConnectingInsecureWebSocket( | 771 webview()->settings()->setAllowConnectingInsecureWebSocket( |
758 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 772 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
759 | 773 |
760 main_render_frame_.reset(main_render_frame); | 774 main_render_frame_.reset(main_render_frame); |
761 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 775 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
762 main_render_frame_->Initialize(); | 776 main_render_frame_->Initialize(); |
763 | 777 |
(...skipping 3287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4051 std::vector<gfx::Size> sizes; | 4065 std::vector<gfx::Size> sizes; |
4052 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4066 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4053 if (!url.isEmpty()) | 4067 if (!url.isEmpty()) |
4054 urls.push_back( | 4068 urls.push_back( |
4055 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4069 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4056 } | 4070 } |
4057 SendUpdateFaviconURL(urls); | 4071 SendUpdateFaviconURL(urls); |
4058 } | 4072 } |
4059 | 4073 |
4060 } // namespace content | 4074 } // namespace content |
OLD | NEW |