Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 2363573002: Move ViewHostMsg_CreateWindow to mojom (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 // Maximum allocation size allowed for image scaling filters that 242 // Maximum allocation size allowed for image scaling filters that
243 // require pre-scaling. Skia will fallback to a filter that doesn't 243 // require pre-scaling. Skia will fallback to a filter that doesn't
244 // require pre-scaling if the default filter would require an 244 // require pre-scaling if the default filter would require an
245 // allocation that exceeds this limit. 245 // allocation that exceeds this limit.
246 const size_t kImageCacheSingleAllocationByteLimit = 64 * 1024 * 1024; 246 const size_t kImageCacheSingleAllocationByteLimit = 64 * 1024 * 1024;
247 247
248 // Unique identifier for each output surface created. 248 // Unique identifier for each output surface created.
249 uint32_t g_next_compositor_frame_sink_id = 1; 249 uint32_t g_next_compositor_frame_sink_id = 1;
250 250
251 // An implementation of mojom::RenderMessageFilter which can be mocked out
252 // for tests which may indirectly send messages over this interface.
253 mojom::RenderMessageFilter* g_render_message_filter_for_testing;
254
251 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access 255 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
252 // incorrectly from the wrong thread. 256 // incorrectly from the wrong thread.
253 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > 257 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> >
254 lazy_tls = LAZY_INSTANCE_INITIALIZER; 258 lazy_tls = LAZY_INSTANCE_INITIALIZER;
255 259
256 // v8::MemoryPressureLevel should correspond to base::MemoryPressureListener. 260 // v8::MemoryPressureLevel should correspond to base::MemoryPressureListener.
257 static_assert(static_cast<v8::MemoryPressureLevel>( 261 static_assert(static_cast<v8::MemoryPressureLevel>(
258 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE) == 262 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE) ==
259 v8::MemoryPressureLevel::kNone, "none level not align"); 263 v8::MemoryPressureLevel::kNone, "none level not align");
260 static_assert(static_cast<v8::MemoryPressureLevel>( 264 static_assert(static_cast<v8::MemoryPressureLevel>(
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 567 }
564 568
565 // static 569 // static
566 RenderThreadImpl* RenderThreadImpl::Create( 570 RenderThreadImpl* RenderThreadImpl::Create(
567 std::unique_ptr<base::MessageLoop> main_message_loop, 571 std::unique_ptr<base::MessageLoop> main_message_loop,
568 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler) { 572 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler) {
569 return new RenderThreadImpl(std::move(main_message_loop), 573 return new RenderThreadImpl(std::move(main_message_loop),
570 std::move(renderer_scheduler)); 574 std::move(renderer_scheduler));
571 } 575 }
572 576
577 // static
573 RenderThreadImpl* RenderThreadImpl::current() { 578 RenderThreadImpl* RenderThreadImpl::current() {
574 return lazy_tls.Pointer()->Get(); 579 return lazy_tls.Pointer()->Get();
575 } 580 }
576 581
582 // static
583 mojom::RenderMessageFilter* RenderThreadImpl::current_render_message_filter() {
584 if (g_render_message_filter_for_testing)
585 return g_render_message_filter_for_testing;
586 DCHECK(current());
587 return current()->render_message_filter();
588 }
589
590 // static
591 void RenderThreadImpl::SetRenderMessageFilterForTesting(
592 mojom::RenderMessageFilter* render_message_filter) {
593 g_render_message_filter_for_testing = render_message_filter;
594 }
595
577 RenderThreadImpl::RenderThreadImpl( 596 RenderThreadImpl::RenderThreadImpl(
578 const InProcessChildThreadParams& params, 597 const InProcessChildThreadParams& params,
579 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler, 598 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler,
580 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue) 599 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue)
581 : ChildThreadImpl(Options::Builder() 600 : ChildThreadImpl(Options::Builder()
582 .InBrowserProcess(params) 601 .InBrowserProcess(params)
583 .UseMojoChannel(true) 602 .UseMojoChannel(true)
584 .AutoStartMojoShellConnection(false) 603 .AutoStartMojoShellConnection(false)
585 .ConnectToBrowser(true) 604 .ConnectToBrowser(true)
586 .Build()), 605 .Build()),
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 if (blink::mainThreadIsolate()) { 2311 if (blink::mainThreadIsolate()) {
2293 blink::mainThreadIsolate()->MemoryPressureNotification( 2312 blink::mainThreadIsolate()->MemoryPressureNotification(
2294 v8::MemoryPressureLevel::kCritical); 2313 v8::MemoryPressureLevel::kCritical);
2295 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2314 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2296 v8::MemoryPressureLevel::kCritical); 2315 v8::MemoryPressureLevel::kCritical);
2297 } 2316 }
2298 } 2317 }
2299 2318
2300 2319
2301 } // namespace content 2320 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698