| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 private: | 353 private: |
| 354 int32_t routing_id_highmark_; | 354 int32_t routing_id_highmark_; |
| 355 mojo::StrongBinding<mojom::FrameFactory> binding_; | 355 mojo::StrongBinding<mojom::FrameFactory> binding_; |
| 356 }; | 356 }; |
| 357 | 357 |
| 358 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 358 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
| 359 new FrameFactoryImpl(std::move(request)); | 359 new FrameFactoryImpl(std::move(request)); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void SetupEmbeddedWorkerOnWorkerThread( | 362 void SetupEmbeddedWorkerOnWorkerThread( |
| 363 shell::mojom::InterfaceProviderRequest services, | 363 shell::mojom::InterfaceProviderRequest request, |
| 364 shell::mojom::InterfaceProviderPtrInfo exposed_services) { | 364 shell::mojom::InterfaceProviderPtrInfo remote_interfaces) { |
| 365 ServiceWorkerContextClient* client = | 365 ServiceWorkerContextClient* client = |
| 366 ServiceWorkerContextClient::ThreadSpecificInstance(); | 366 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 367 // It is possible for client to be null if for some reason the worker died | 367 // It is possible for client to be null if for some reason the worker died |
| 368 // before this call made it to the worker thread. In that case just do | 368 // before this call made it to the worker thread. In that case just do |
| 369 // nothing and let mojo close the connection. | 369 // nothing and let mojo close the connection. |
| 370 if (!client) | 370 if (!client) |
| 371 return; | 371 return; |
| 372 client->BindServiceRegistry(std::move(services), | 372 client->BindInterfaceProviders(std::move(request), |
| 373 mojo::MakeProxy(std::move(exposed_services))); | 373 mojo::MakeProxy(std::move(remote_interfaces))); |
| 374 } | 374 } |
| 375 | 375 |
| 376 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { | 376 class EmbeddedWorkerSetupImpl : public mojom::EmbeddedWorkerSetup { |
| 377 public: | 377 public: |
| 378 explicit EmbeddedWorkerSetupImpl( | 378 explicit EmbeddedWorkerSetupImpl( |
| 379 mojo::InterfaceRequest<mojom::EmbeddedWorkerSetup> request) | 379 mojo::InterfaceRequest<mojom::EmbeddedWorkerSetup> request) |
| 380 : binding_(this, std::move(request)) {} | 380 : binding_(this, std::move(request)) {} |
| 381 | 381 |
| 382 void ExchangeInterfaceProviders( | 382 void ExchangeInterfaceProviders( |
| 383 int32_t thread_id, | 383 int32_t thread_id, |
| 384 shell::mojom::InterfaceProviderRequest services, | 384 shell::mojom::InterfaceProviderRequest request, |
| 385 shell::mojom::InterfaceProviderPtr exposed_services) override { | 385 shell::mojom::InterfaceProviderPtr remote_interfaces) override { |
| 386 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( | 386 WorkerThreadRegistry::Instance()->GetTaskRunnerFor(thread_id)->PostTask( |
| 387 FROM_HERE, | 387 FROM_HERE, |
| 388 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&services), | 388 base::Bind(&SetupEmbeddedWorkerOnWorkerThread, base::Passed(&request), |
| 389 base::Passed(exposed_services.PassInterface()))); | 389 base::Passed(remote_interfaces.PassInterface()))); |
| 390 } | 390 } |
| 391 | 391 |
| 392 private: | 392 private: |
| 393 mojo::StrongBinding<mojom::EmbeddedWorkerSetup> binding_; | 393 mojo::StrongBinding<mojom::EmbeddedWorkerSetup> binding_; |
| 394 }; | 394 }; |
| 395 | 395 |
| 396 void CreateEmbeddedWorkerSetup( | 396 void CreateEmbeddedWorkerSetup( |
| 397 mojo::InterfaceRequest<mojom::EmbeddedWorkerSetup> request) { | 397 mojo::InterfaceRequest<mojom::EmbeddedWorkerSetup> request) { |
| 398 new EmbeddedWorkerSetupImpl(std::move(request)); | 398 new EmbeddedWorkerSetupImpl(std::move(request)); |
| 399 } | 399 } |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2209 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
| 2210 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2210 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
| 2211 | 2211 |
| 2212 blink::mainThreadIsolate()->MemoryPressureNotification( | 2212 blink::mainThreadIsolate()->MemoryPressureNotification( |
| 2213 v8_memory_pressure_level); | 2213 v8_memory_pressure_level); |
| 2214 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2214 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
| 2215 v8_memory_pressure_level); | 2215 v8_memory_pressure_level); |
| 2216 } | 2216 } |
| 2217 | 2217 |
| 2218 } // namespace content | 2218 } // namespace content |
| OLD | NEW |