| 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 <utility> | 10 #include <utility> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 31 #include "base/threading/simple_thread.h" | 31 #include "base/threading/simple_thread.h" |
| 32 #include "base/threading/thread_local.h" | 32 #include "base/threading/thread_local.h" |
| 33 #include "base/threading/thread_restrictions.h" | 33 #include "base/threading/thread_restrictions.h" |
| 34 #include "base/threading/thread_task_runner_handle.h" | 34 #include "base/threading/thread_task_runner_handle.h" |
| 35 #include "base/trace_event/trace_event.h" | 35 #include "base/trace_event/trace_event.h" |
| 36 #include "base/values.h" | 36 #include "base/values.h" |
| 37 #include "build/build_config.h" | 37 #include "build/build_config.h" |
| 38 #include "cc/base/histograms.h" | 38 #include "cc/base/histograms.h" |
| 39 #include "cc/base/switches.h" | 39 #include "cc/base/switches.h" |
| 40 #include "cc/blink/web_external_bitmap_impl.h" | |
| 41 #include "cc/blink/web_layer_impl.h" | 40 #include "cc/blink/web_layer_impl.h" |
| 42 #include "cc/output/buffer_to_texture_target_map.h" | 41 #include "cc/output/buffer_to_texture_target_map.h" |
| 43 #include "cc/output/copy_output_request.h" | 42 #include "cc/output/copy_output_request.h" |
| 44 #include "cc/output/output_surface.h" | 43 #include "cc/output/output_surface.h" |
| 45 #include "cc/output/vulkan_in_process_context_provider.h" | 44 #include "cc/output/vulkan_in_process_context_provider.h" |
| 46 #include "cc/raster/task_graph_runner.h" | 45 #include "cc/raster/task_graph_runner.h" |
| 47 #include "cc/trees/layer_tree_host_common.h" | 46 #include "cc/trees/layer_tree_host_common.h" |
| 48 #include "cc/trees/layer_tree_settings.h" | 47 #include "cc/trees/layer_tree_settings.h" |
| 49 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h" | 48 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h" |
| 50 #include "content/child/appcache/appcache_dispatcher.h" | 49 #include "content/child/appcache/appcache_dispatcher.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 histogram_name, min, max, buckets, | 309 histogram_name, min, max, buckets, |
| 311 base::Histogram::kUmaTargetedHistogramFlag); | 310 base::Histogram::kUmaTargetedHistogramFlag); |
| 312 return histogram; | 311 return histogram; |
| 313 } | 312 } |
| 314 | 313 |
| 315 void AddHistogramSample(void* hist, int sample) { | 314 void AddHistogramSample(void* hist, int sample) { |
| 316 base::Histogram* histogram = static_cast<base::Histogram*>(hist); | 315 base::Histogram* histogram = static_cast<base::Histogram*>(hist); |
| 317 histogram->Add(sample); | 316 histogram->Add(sample); |
| 318 } | 317 } |
| 319 | 318 |
| 320 std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmapFunction( | |
| 321 const gfx::Size& size) { | |
| 322 return ChildThreadImpl::current()->shared_bitmap_manager()-> | |
| 323 AllocateSharedBitmap(size); | |
| 324 } | |
| 325 | |
| 326 void NotifyTimezoneChangeOnThisThread() { | 319 void NotifyTimezoneChangeOnThisThread() { |
| 327 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 320 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 328 if (!isolate) | 321 if (!isolate) |
| 329 return; | 322 return; |
| 330 v8::Date::DateTimeConfigurationChangeNotification(isolate); | 323 v8::Date::DateTimeConfigurationChangeNotification(isolate); |
| 331 } | 324 } |
| 332 | 325 |
| 333 class FrameFactoryImpl : public mojom::FrameFactory { | 326 class FrameFactoryImpl : public mojom::FrameFactory { |
| 334 public: | 327 public: |
| 335 explicit FrameFactoryImpl(mojom::FrameFactoryRequest request) | 328 explicit FrameFactoryImpl(mojom::FrameFactoryRequest request) |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 // If we do not track widget visibility, then assume conservatively that | 1244 // If we do not track widget visibility, then assume conservatively that |
| 1252 // the isolate is in background. This reduces memory usage. | 1245 // the isolate is in background. This reduces memory usage. |
| 1253 isolate->IsolateInBackgroundNotification(); | 1246 isolate->IsolateInBackgroundNotification(); |
| 1254 } | 1247 } |
| 1255 | 1248 |
| 1256 renderer_scheduler_->SetTimerQueueSuspensionWhenBackgroundedEnabled( | 1249 renderer_scheduler_->SetTimerQueueSuspensionWhenBackgroundedEnabled( |
| 1257 GetContentClient() | 1250 GetContentClient() |
| 1258 ->renderer() | 1251 ->renderer() |
| 1259 ->AllowTimerSuspensionWhenProcessBackgrounded()); | 1252 ->AllowTimerSuspensionWhenProcessBackgrounded()); |
| 1260 | 1253 |
| 1261 cc_blink::SetSharedBitmapAllocationFunction(AllocateSharedBitmapFunction); | |
| 1262 | |
| 1263 SkGraphics::SetResourceCacheSingleAllocationByteLimit( | 1254 SkGraphics::SetResourceCacheSingleAllocationByteLimit( |
| 1264 kImageCacheSingleAllocationByteLimit); | 1255 kImageCacheSingleAllocationByteLimit); |
| 1265 | 1256 |
| 1266 // Hook up blink's codecs so skia can call them | 1257 // Hook up blink's codecs so skia can call them |
| 1267 SkGraphics::SetImageGeneratorFromEncodedFactory( | 1258 SkGraphics::SetImageGeneratorFromEncodedFactory( |
| 1268 blink::WebImageGenerator::create); | 1259 blink::WebImageGenerator::create); |
| 1269 | 1260 |
| 1270 if (command_line.HasSwitch(switches::kMemoryMetrics)) { | 1261 if (command_line.HasSwitch(switches::kMemoryMetrics)) { |
| 1271 memory_observer_.reset(new MemoryObserver()); | 1262 memory_observer_.reset(new MemoryObserver()); |
| 1272 message_loop()->AddTaskObserver(memory_observer_.get()); | 1263 message_loop()->AddTaskObserver(memory_observer_.get()); |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2231 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2222 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2232 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2223 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2233 | 2224 |
| 2234 blink::mainThreadIsolate()->MemoryPressureNotification( | 2225 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2235 v8_memory_pressure_level); | 2226 v8_memory_pressure_level); |
| 2236 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2227 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2237 v8_memory_pressure_level); | 2228 v8_memory_pressure_level); |
| 2238 } | 2229 } |
| 2239 | 2230 |
| 2240 } // namespace content | 2231 } // namespace content |
| OLD | NEW |