Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
wpf
提交
d03fc452
W
wpf
项目概览
dotNET Platform
/
wpf
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wpf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d03fc452
编写于
2月 08, 2021
作者:
L
Levi Broderick
提交者:
GitHub
2月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove custom copy of PtrToStringChars (#3117)
上级
6866a67f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
8 addition
and
71 deletion
+8
-71
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Common.h
...t.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Common.h
+2
-1
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp
...pf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp
+3
-3
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollection.cpp
...DirectWriteForwarder/CPP/DWriteWrapper/FontCollection.cpp
+0
-1
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/LocalizedStrings.cpp
...rectWriteForwarder/CPP/DWriteWrapper/LocalizedStrings.cpp
+1
-2
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.cpp
.../src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.cpp
+1
-3
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.h
...pf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.h
+1
-0
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/wpfvcclr.h
...rosoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/wpfvcclr.h
+0
-61
未找到文件。
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Common.h
浏览文件 @
d03fc452
...
...
@@ -6,6 +6,7 @@
#define __COMMON_H
#include "precomp.hxx"
#include <vcclr.h>
using
namespace
System
::
Security
;
...
...
@@ -64,7 +65,7 @@ public:
__declspec
(
noinline
)
const
cli
::
interior_ptr
<
const
System
::
Char
>
static
GetPtrToStringChars
(
System
::
String
^
s
)
{
return
Critical
PtrToStringChars
(
s
);
return
PtrToStringChars
(
s
);
}
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp
浏览文件 @
d03fc452
...
...
@@ -263,7 +263,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
{
System
::
String
^
uriString
=
uri
->
AbsoluteUri
;
IDWriteFontCollection
*
dwriteFontCollection
=
NULL
;
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
Critical
PtrToStringChars
(
uriString
);
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
PtrToStringChars
(
uriString
);
IntPtr
pIDWriteFontCollectionLoaderMirror
=
Marshal
::
GetComInterfaceForObject
(
_wpfFontCollectionLoader
,
...
...
@@ -301,7 +301,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
if
(
isLocal
)
{
//Protect the pointer to the filepath from being moved around by the garbage collector.
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
Critical
PtrToStringChars
(
filePathUri
->
LocalPath
);
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
PtrToStringChars
(
filePathUri
->
LocalPath
);
// DWrite currently has a slow lookup for the last write time, which
// introduced a noticable perf regression when we switched over.
...
...
@@ -387,7 +387,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
{
System
::
String
^
filePath
=
filePathUri
->
AbsoluteUri
;
//Protect the pointer to the filepath from being moved around by the garbage collector.
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
Critical
PtrToStringChars
(
filePath
);
pin_ptr
<
const
WCHAR
>
uriPathWChar
=
PtrToStringChars
(
filePath
);
IntPtr
pIDWriteFontFileLoaderMirror
=
Marshal
::
GetComInterfaceForObject
(
fontFileLoader
,
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontCollection.cpp
浏览文件 @
d03fc452
...
...
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
#include "FontCollection.h"
#include <wpfvcclr.h>
namespace
MS
{
namespace
Internal
{
namespace
Text
{
namespace
TextInterface
{
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/LocalizedStrings.cpp
浏览文件 @
d03fc452
...
...
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
#include "LocalizedStrings.h"
#include "wpfvcclr.h"
namespace
MS
{
namespace
Internal
{
namespace
Text
{
namespace
TextInterface
{
...
...
@@ -144,7 +143,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
}
else
{
pin_ptr
<
const
wchar_t
>
localeNameWChar
=
Critical
PtrToStringChars
(
localeName
);
pin_ptr
<
const
wchar_t
>
localeNameWChar
=
PtrToStringChars
(
localeName
);
BOOL
exists
=
FALSE
;
UINT32
localeNameIndex
=
0
;
HRESULT
hr
=
_localizedStrings
->
Value
->
FindLocaleName
(
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.cpp
浏览文件 @
d03fc452
...
...
@@ -4,8 +4,6 @@
#include "precomp.hxx"
#include "util2.h"
#include <wpfvcclr.h>
namespace
MS
{
namespace
Internal
{
namespace
FontCache
{
...
...
@@ -15,7 +13,7 @@ bool Util2::GetRegistryKeyLastWriteTimeUtc(System::String ^ registryKey, [System
{
HKEY
hkey
=
NULL
;
pin_ptr
<
const
wchar_t
>
registryKeyUnmanaged
=
Critical
PtrToStringChars
(
registryKey
);
pin_ptr
<
const
wchar_t
>
registryKeyUnmanaged
=
PtrToStringChars
(
registryKey
);
if
(
::
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
registryKeyUnmanaged
,
0
,
KEY_QUERY_VALUE
,
&
hkey
)
==
ERROR_SUCCESS
)
{
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/util2.h
浏览文件 @
d03fc452
...
...
@@ -4,6 +4,7 @@
#pragma once
#include <vcclr.h>
namespace
MS
{
namespace
Internal
{
namespace
FontCache
{
...
...
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/wpfvcclr.h
已删除
100644 → 0
浏览文件 @
6866a67f
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//------------------------------------------------------------------------------
// This file is a copy of <vcclr.h>, with modifications necessary for WPF.
//------------------------------------------------------------------------------
#if _MSC_VER > 1000
#pragma once
#endif
#if !defined(_INC_WPFVCCLR)
#define _INC_WPFVCCLR
#ifndef RC_INVOKED
#using <mscorlib.dll>
#include <gcroot.h>
#pragma warning(push)
#pragma warning(disable:4400)
#ifdef __cplusplus_cli
typedef
cli
::
interior_ptr
<
const
System
::
Char
>
__const_Char_ptr
;
typedef
cli
::
interior_ptr
<
const
System
::
Byte
>
__const_Byte_ptr
;
typedef
cli
::
interior_ptr
<
System
::
Byte
>
_Byte_ptr
;
typedef
const
System
::
String
^
__const_String_handle
;
#define _NULLPTR nullptr
#else
typedef
const
System
::
Char
*
__const_Char_ptr
;
typedef
const
System
::
Byte
*
__const_Byte_ptr
;
typedef
System
::
Byte
*
_Byte_ptr
;
typedef
const
System
::
String
*
__const_String_handle
;
#define _NULLPTR 0
#endif
/// <remarks>
/// The standard PtrToStringChars function in vcclr.h is not annotated as
/// SecurityCritical. A recent change to the compiler detects this and
/// prevents it from being inlined. For some reason, this now causes
/// JIT-ing the first time this method is called. This JIT happens in a
/// startup code path that is sensitive to perf. So we make a copy here
/// and annotate it.
/// </remarks>
inline
__const_Char_ptr
CriticalPtrToStringChars
(
__const_String_handle
s
)
{
_Byte_ptr
bp
=
const_cast
<
_Byte_ptr
>
(
reinterpret_cast
<
__const_Byte_ptr
>
(
s
));
if
(
bp
!=
_NULLPTR
)
{
unsigned
offset
=
System
::
Runtime
::
CompilerServices
::
RuntimeHelpers
::
OffsetToStringData
;
bp
+=
offset
;
}
return
reinterpret_cast
<
__const_Char_ptr
>
(
bp
);
}
#pragma warning(pop)
#undef _NULLPTR
#endif
/* RC_INVOKED */
#endif //_INC_WPFVCCLR
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录