Chromium Code Reviews| 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/browser/plugin_process_host.h" | 5 #include "content/browser/plugin_process_host.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
| 10 #include <utility> // for pair<> | 10 #include <utility> // for pair<> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/base_switches.h" | 15 #include "base/base_switches.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/strings/string_number_conversions.h" | |
| 22 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "content/browser/browser_child_process_host_impl.h" | 25 #include "content/browser/browser_child_process_host_impl.h" |
| 25 #include "content/browser/loader/resource_message_filter.h" | 26 #include "content/browser/loader/resource_message_filter.h" |
| 26 #include "content/browser/gpu/gpu_data_manager_impl.h" | 27 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 27 #include "content/browser/plugin_service_impl.h" | 28 #include "content/browser/plugin_service_impl.h" |
| 28 #include "content/common/child_process_host_impl.h" | 29 #include "content/common/child_process_host_impl.h" |
| 29 #include "content/common/plugin_process_messages.h" | 30 #include "content/common/plugin_process_messages.h" |
| 30 #include "content/common/resource_messages.h" | 31 #include "content/common/resource_messages.h" |
| 31 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 | 410 |
| 410 if (client) { | 411 if (client) { |
| 411 resource_context_map_[client->ID()] = client->GetResourceContext(); | 412 resource_context_map_[client->ID()] = client->GetResourceContext(); |
| 412 client->OnChannelOpened(channel_handle); | 413 client->OnChannelOpened(channel_handle); |
| 413 } | 414 } |
| 414 sent_requests_.pop_front(); | 415 sent_requests_.pop_front(); |
| 415 } | 416 } |
| 416 | 417 |
| 417 void PluginProcessHost::OnChannelDestroyed(int renderer_id) { | 418 void PluginProcessHost::OnChannelDestroyed(int renderer_id) { |
| 418 resource_context_map_.erase(renderer_id); | 419 resource_context_map_.erase(renderer_id); |
| 420 removed_pids_.insert(renderer_id); | |
| 419 } | 421 } |
| 420 | 422 |
| 421 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, | 423 void PluginProcessHost::GetContexts(const ResourceHostMsg_Request& request, |
| 422 ResourceContext** resource_context, | 424 ResourceContext** resource_context, |
| 423 net::URLRequestContext** request_context) { | 425 net::URLRequestContext** request_context) { |
| 424 *resource_context = resource_context_map_[request.origin_pid]; | 426 *resource_context = resource_context_map_[request.origin_pid]; |
| 427 if (!*resource_context) { | |
| 428 std::string url = request.first_party_for_cookies.spec(); | |
| 429 // Debugging http://crbug.com/302530 | |
| 430 url += std::string("_") + base::IntToString(request.origin_pid); | |
| 431 | |
| 432 for (std::map<int, ResourceContext*>::iterator i = | |
| 433 resource_context_map_.begin(); | |
| 434 i != resource_context_map_.end(); ++i) { | |
| 435 url += std::string("_") + base::IntToString(i->first); | |
| 436 } | |
| 437 | |
| 438 url += "_"; | |
| 439 for (std::set<int>::iterator i = removed_pids_.begin(); | |
| 440 i != removed_pids_.end(); ++i) { | |
|
brettw
2013/10/02 04:01:32
Undent 1 space :)
| |
| 441 url += std::string("_") + base::IntToString(*i); | |
| 442 } | |
| 443 GetContentClient()->SetActiveURL(GURL(url)); | |
| 444 } | |
| 425 *request_context = (*resource_context)->GetRequestContext(); | 445 *request_context = (*resource_context)->GetRequestContext(); |
| 426 } | 446 } |
| 427 | 447 |
| 428 } // namespace content | 448 } // namespace content |
| OLD | NEW |