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_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/allocator/allocator_extension.h" | 12 #include "base/allocator/allocator_extension.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/discardable_memory.h" | 17 #include "base/memory/discardable_memory.h" |
18 #include "base/memory/shared_memory.h" | 18 #include "base/memory/shared_memory.h" |
19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/metrics/stats_table.h" | 21 #include "base/metrics/stats_table.h" |
22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
24 #include "base/strings/string_tokenizer.h" | 24 #include "base/strings/string_tokenizer.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "base/threading/thread_local.h" | 26 #include "base/threading/thread_local.h" |
27 #include "base/threading/thread_restrictions.h" | 27 #include "base/threading/thread_restrictions.h" |
28 #include "base/values.h" | 28 #include "base/values.h" |
| 29 #include "cc/base/switches.h" |
29 #include "content/child/appcache/appcache_dispatcher.h" | 30 #include "content/child/appcache/appcache_dispatcher.h" |
30 #include "content/child/appcache/appcache_frontend_impl.h" | 31 #include "content/child/appcache/appcache_frontend_impl.h" |
31 #include "content/child/child_histogram_message_filter.h" | 32 #include "content/child/child_histogram_message_filter.h" |
32 #include "content/child/db_message_filter.h" | 33 #include "content/child/db_message_filter.h" |
33 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 34 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
34 #include "content/child/indexed_db/indexed_db_message_filter.h" | 35 #include "content/child/indexed_db/indexed_db_message_filter.h" |
35 #include "content/child/npapi/npobject_util.h" | 36 #include "content/child/npapi/npobject_util.h" |
36 #include "content/child/plugin_messages.h" | 37 #include "content/child/plugin_messages.h" |
37 #include "content/child/resource_dispatcher.h" | 38 #include "content/child/resource_dispatcher.h" |
38 #include "content/child/runtime_features.h" | 39 #include "content/child/runtime_features.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 713 |
713 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized()); | 714 FOR_EACH_OBSERVER(RenderProcessObserver, observers_, WebKitInitialized()); |
714 | 715 |
715 devtools_agent_message_filter_ = new DevToolsAgentFilter(); | 716 devtools_agent_message_filter_ = new DevToolsAgentFilter(); |
716 AddFilter(devtools_agent_message_filter_.get()); | 717 AddFilter(devtools_agent_message_filter_.get()); |
717 | 718 |
718 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) | 719 if (GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) |
719 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 720 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
720 | 721 |
721 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); | 722 webkit::SetSharedMemoryAllocationFunction(AllocateSharedMemoryFunction); |
| 723 |
| 724 // Limit use of the scaled image cache to when deferred image decoding |
| 725 // is enabled. |
| 726 // TODO(reveman): Allow use of this cache on Android once |
| 727 // SkDiscardablePixelRef is used for decoded images. crbug.com/330041 |
| 728 bool use_skia_scaled_image_cache = false; |
| 729 #if !defined(OS_ANDROID) |
| 730 use_skia_scaled_image_cache = |
| 731 command_line.HasSwitch(switches::kEnableDeferredImageDecoding) || |
| 732 cc::switches::IsImplSidePaintingEnabled(); |
| 733 #endif |
| 734 if (!use_skia_scaled_image_cache) |
| 735 SkGraphics::SetImageCacheByteLimit(0u); |
722 } | 736 } |
723 | 737 |
724 void RenderThreadImpl::RegisterSchemes() { | 738 void RenderThreadImpl::RegisterSchemes() { |
725 // swappedout: pages should not be accessible, and should also | 739 // swappedout: pages should not be accessible, and should also |
726 // be treated as empty documents that can commit synchronously. | 740 // be treated as empty documents that can commit synchronously. |
727 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); | 741 WebString swappedout_scheme(base::ASCIIToUTF16(kSwappedOutScheme)); |
728 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); | 742 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(swappedout_scheme); |
729 WebSecurityPolicy::registerURLSchemeAsEmptyDocument(swappedout_scheme); | 743 WebSecurityPolicy::registerURLSchemeAsEmptyDocument(swappedout_scheme); |
730 } | 744 } |
731 | 745 |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 if (!gamepad_shared_memory_reader_) | 1368 if (!gamepad_shared_memory_reader_) |
1355 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1369 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
1356 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1370 gamepad_shared_memory_reader_->SampleGamepads(*data); |
1357 } | 1371 } |
1358 | 1372 |
1359 base::ProcessId RenderThreadImpl::renderer_process_id() const { | 1373 base::ProcessId RenderThreadImpl::renderer_process_id() const { |
1360 return renderer_process_id_; | 1374 return renderer_process_id_; |
1361 } | 1375 } |
1362 | 1376 |
1363 } // namespace content | 1377 } // namespace content |
OLD | NEW |