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

Side by Side Diff: content/browser/worker_host/worker_process_host.cc

Issue 338353007: Implementation of shared worker code path for WebView file system permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_sharedworker
Patch Set: Rename + changes are made. Created 6 years, 6 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
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/browser/worker_host/worker_process_host.h" 5 #include "content/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 worker_process_id); 134 worker_process_id);
135 } 135 }
136 136
137 } // namespace 137 } // namespace
138 138
139 WorkerProcessHost::WorkerProcessHost( 139 WorkerProcessHost::WorkerProcessHost(
140 ResourceContext* resource_context, 140 ResourceContext* resource_context,
141 const WorkerStoragePartition& partition) 141 const WorkerStoragePartition& partition)
142 : resource_context_(resource_context), 142 : resource_context_(resource_context),
143 partition_(partition), 143 partition_(partition),
144 process_launched_(false) { 144 process_launched_(false),
145 weak_factory_(this) {
145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
146 DCHECK(resource_context_); 147 DCHECK(resource_context_);
147 process_.reset( 148 process_.reset(
148 new BrowserChildProcessHostImpl(PROCESS_TYPE_WORKER, this)); 149 new BrowserChildProcessHostImpl(PROCESS_TYPE_WORKER, this));
149 } 150 }
150 151
151 WorkerProcessHost::~WorkerProcessHost() { 152 WorkerProcessHost::~WorkerProcessHost() {
152 // If we crashed, tell the RenderViewHosts. 153 // If we crashed, tell the RenderViewHosts.
153 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { 154 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) {
154 if (!i->load_failed()) { 155 if (!i->load_failed()) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 OnWorkerContextClosed) 380 OnWorkerContextClosed)
380 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed, 381 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextDestroyed,
381 OnWorkerContextDestroyed) 382 OnWorkerContextDestroyed)
382 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded, 383 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoaded,
383 OnWorkerScriptLoaded) 384 OnWorkerScriptLoaded)
384 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed, 385 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerScriptLoadFailed,
385 OnWorkerScriptLoadFailed) 386 OnWorkerScriptLoadFailed)
386 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected, 387 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerConnected,
387 OnWorkerConnected) 388 OnWorkerConnected)
388 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) 389 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase)
389 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_RequestFileSystemAccessSync, 390 IPC_MESSAGE_HANDLER_DELAY_REPLY(
390 OnRequestFileSystemAccessSync) 391 WorkerProcessHostMsg_RequestFileSystemAccessSync,
392 OnRequestFileSystemAccess)
391 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) 393 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB)
392 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_ForceKillWorker, 394 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_ForceKillWorker,
393 OnForceKillWorkerProcess) 395 OnForceKillWorkerProcess)
394 IPC_MESSAGE_UNHANDLED(handled = false) 396 IPC_MESSAGE_UNHANDLED(handled = false)
395 IPC_END_MESSAGE_MAP() 397 IPC_END_MESSAGE_MAP()
396 398
397 return handled; 399 return handled;
398 } 400 }
399 401
400 // Sent to notify the browser process when a worker context invokes close(), so 402 // Sent to notify the browser process when a worker context invokes close(), so
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 const GURL& url, 468 const GURL& url,
467 const base::string16& name, 469 const base::string16& name,
468 const base::string16& display_name, 470 const base::string16& display_name,
469 unsigned long estimated_size, 471 unsigned long estimated_size,
470 bool* result) { 472 bool* result) {
471 *result = GetContentClient()->browser()->AllowWorkerDatabase( 473 *result = GetContentClient()->browser()->AllowWorkerDatabase(
472 url, name, display_name, estimated_size, resource_context_, 474 url, name, display_name, estimated_size, resource_context_,
473 GetRenderFrameIDsForWorker(worker_route_id)); 475 GetRenderFrameIDsForWorker(worker_route_id));
474 } 476 }
475 477
476 void WorkerProcessHost::OnRequestFileSystemAccessSync(int worker_route_id, 478 void WorkerProcessHost::OnRequestFileSystemAccess(int worker_route_id,
477 const GURL& url, 479 const GURL& url,
478 bool* result) { 480 IPC::Message* reply_msg) {
479 *result = GetContentClient()->browser()->AllowWorkerFileSystem( 481 GetContentClient()->browser()->RequestWorkerFileSystemAccess(
480 url, resource_context_, GetRenderFrameIDsForWorker(worker_route_id)); 482 url,
483 resource_context_,
484 GetRenderFrameIDsForWorker(worker_route_id),
485 base::Bind(&WorkerProcessHost::OnRequestFileSystemAccessResponse,
486 weak_factory_.GetWeakPtr(),
487 base::Passed(scoped_ptr<IPC::Message>(reply_msg))));
488 }
489
490 void WorkerProcessHost::OnRequestFileSystemAccessResponse(
491 scoped_ptr<IPC::Message> reply_msg,
492 bool allowed) {
493 WorkerProcessHostMsg_RequestFileSystemAccessSync::WriteReplyParams(
494 reply_msg.get(),
495 allowed);
496 Send(reply_msg.release());
481 } 497 }
482 498
483 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, 499 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id,
484 const GURL& url, 500 const GURL& url,
485 const base::string16& name, 501 const base::string16& name,
486 bool* result) { 502 bool* result) {
487 *result = GetContentClient()->browser()->AllowWorkerIndexedDB( 503 *result = GetContentClient()->browser()->AllowWorkerIndexedDB(
488 url, name, resource_context_, 504 url, name, resource_context_,
489 GetRenderFrameIDsForWorker(worker_route_id)); 505 GetRenderFrameIDsForWorker(worker_route_id));
490 } 506 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 return false; 837 return false;
822 } 838 }
823 839
824 WorkerProcessHost::WorkerInstance::FilterInfo 840 WorkerProcessHost::WorkerInstance::FilterInfo
825 WorkerProcessHost::WorkerInstance::GetFilter() const { 841 WorkerProcessHost::WorkerInstance::GetFilter() const {
826 DCHECK(NumFilters() == 1); 842 DCHECK(NumFilters() == 1);
827 return *filters_.begin(); 843 return *filters_.begin();
828 } 844 }
829 845
830 } // namespace content 846 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698