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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 1851213002: Remove sandbox on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nacl compile issues Created 4 years, 8 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/ppapi_plugin/ppapi_thread.h" 5 #include "content/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "ppapi/proxy/plugin_message_filter.h" 49 #include "ppapi/proxy/plugin_message_filter.h"
50 #include "ppapi/proxy/ppapi_messages.h" 50 #include "ppapi/proxy/ppapi_messages.h"
51 #include "ppapi/proxy/resource_reply_thread_registrar.h" 51 #include "ppapi/proxy/resource_reply_thread_registrar.h"
52 #include "third_party/WebKit/public/web/WebKit.h" 52 #include "third_party/WebKit/public/web/WebKit.h"
53 #include "ui/base/ui_base_switches.h" 53 #include "ui/base/ui_base_switches.h"
54 54
55 #if defined(OS_WIN) 55 #if defined(OS_WIN)
56 #include "base/win/win_util.h" 56 #include "base/win/win_util.h"
57 #include "base/win/windows_version.h" 57 #include "base/win/windows_version.h"
58 #include "content/child/font_warmup_win.h" 58 #include "content/child/font_warmup_win.h"
59 #include "sandbox/win/src/sandbox.h"
60 #elif defined(OS_MACOSX) 59 #elif defined(OS_MACOSX)
61 #include "content/common/sandbox_init_mac.h" 60 #include "content/common/sandbox_init_mac.h"
62 #endif 61 #endif
63 62
64 #if defined(OS_WIN) 63 #if defined(OS_WIN)
65 const char kWidevineCdmAdapterFileName[] = "widevinecdmadapter.dll"; 64 const char kWidevineCdmAdapterFileName[] = "widevinecdmadapter.dll";
66 65
67 extern sandbox::TargetServices* g_target_services;
68
69 // Used by EnumSystemLocales for warming up. 66 // Used by EnumSystemLocales for warming up.
70 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) { 67 static BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) {
71 return TRUE; 68 return TRUE;
72 } 69 }
73 70
74 static BOOL CALLBACK EnumLocalesProcEx( 71 static BOOL CALLBACK EnumLocalesProcEx(
75 LPWSTR lpLocaleString, 72 LPWSTR lpLocaleString,
76 DWORD dwFlags, 73 DWORD dwFlags,
77 LPARAM lParam) { 74 LPARAM lParam) {
78 return TRUE; 75 return TRUE;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 ReportLoadResult(path, ENTRY_POINT_MISSING); 349 ReportLoadResult(path, ENTRY_POINT_MISSING);
353 return; 350 return;
354 } 351 }
355 } 352 }
356 } 353 }
357 354
358 #if defined(OS_WIN) 355 #if defined(OS_WIN)
359 // If code subsequently tries to exit using abort(), force a crash (since 356 // If code subsequently tries to exit using abort(), force a crash (since
360 // otherwise these would be silent terminations and fly under the radar). 357 // otherwise these would be silent terminations and fly under the radar).
361 base::win::SetAbortBehaviorForCrashReporting(); 358 base::win::SetAbortBehaviorForCrashReporting();
362
363 // Once we lower the token the sandbox is locked down and no new modules
364 // can be loaded. TODO(cpu): consider changing to the loading style of
365 // regular plugins.
366 if (g_target_services) {
367 // Let Flash and Widevine CDM adapter load DXVA before lockdown on Vista+.
368 if (permissions.HasPermission(ppapi::PERMISSION_FLASH) ||
369 path.BaseName().MaybeAsASCII() == kWidevineCdmAdapterFileName) {
370 if (base::win::OSInfo::GetInstance()->version() >=
371 base::win::VERSION_VISTA) {
372 LoadLibraryA("dxva2.dll");
373 }
374 }
375
376 if (permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
377 if (base::win::OSInfo::GetInstance()->version() >=
378 base::win::VERSION_WIN7) {
379 base::CPU cpu;
380 if (cpu.vendor_name() == "AuthenticAMD") {
381 // The AMD crypto acceleration is only AMD Bulldozer and above.
382 #if defined(_WIN64)
383 LoadLibraryA("amdhcp64.dll");
384 #else
385 LoadLibraryA("amdhcp32.dll");
386 #endif
387 }
388 }
389 }
390
391 // Cause advapi32 to load before the sandbox is turned on.
392 unsigned int dummy_rand;
393 rand_s(&dummy_rand);
394
395 WarmupWindowsLocales(permissions);
396
397 if (!base::win::IsUser32AndGdi32Available() &&
398 permissions.HasPermission(ppapi::PERMISSION_FLASH)) {
399 PatchGdiFontEnumeration(path);
400 }
401
402 g_target_services->LowerToken();
403 }
404 #endif 359 #endif
405 360
406 if (is_broker_) { 361 if (is_broker_) {
407 // Get the InitializeBroker function (required). 362 // Get the InitializeBroker function (required).
408 InitializeBrokerFunc init_broker = 363 InitializeBrokerFunc init_broker =
409 reinterpret_cast<InitializeBrokerFunc>( 364 reinterpret_cast<InitializeBrokerFunc>(
410 library.GetFunctionPointer("PPP_InitializeBroker")); 365 library.GetFunctionPointer("PPP_InitializeBroker"));
411 if (!init_broker) { 366 if (!init_broker) {
412 LOG(WARNING) << "No PPP_InitializeBroker in plugin library"; 367 LOG(WARNING) << "No PPP_InitializeBroker in plugin library";
413 ReportLoadResult(path, ENTRY_POINT_MISSING); 368 ReportLoadResult(path, ENTRY_POINT_MISSING);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 GetHistogramName(is_broker_, "LoadTime", path), 558 GetHistogramName(is_broker_, "LoadTime", path),
604 base::TimeDelta::FromMilliseconds(1), 559 base::TimeDelta::FromMilliseconds(1),
605 base::TimeDelta::FromSeconds(10), 560 base::TimeDelta::FromSeconds(10),
606 50, 561 50,
607 base::HistogramBase::kUmaTargetedHistogramFlag); 562 base::HistogramBase::kUmaTargetedHistogramFlag);
608 563
609 histogram->AddTime(load_time); 564 histogram->AddTime(load_time);
610 } 565 }
611 566
612 } // namespace content 567 } // namespace content
OLDNEW
« no previous file with comments | « content/ppapi_plugin/ppapi_plugin_main.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698