Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance StreamAdapter to more effeciently deal with MemoryStream #856

Merged
merged 3 commits into from
Mar 3, 2015

Conversation

rassilon
Copy link
Contributor

@rassilon rassilon commented Mar 3, 2015

...emoryStreams, and add lame header to ResourceHandler usage in CefExample.cs.

Additionally, allocate Headers NameValueCollection in constructor of ResourceHandler.

Sadly, without a change to ClientAdapter.cpp to pass the header data to CEF due to a debug flavor bug in CEF, you can't easily test this change. :(

If you do test this with the CEF change or a Release flavor with the ClientAdapter.cpp change, then this works correctly.

Bill

…h MemoryStreams, and add lame header to ResourceHandler usage in CefExample.cs.

Additionally, allocate Headers NameValueCollection in constructor.
@jankurianski
Copy link
Member

Looks like the build failed due to the following line in StreamAdapter.h:

bool isMemoryStream = false;

c:\projects\cefsharp\cefsharp.core\internals\StreamAdapter.h(20): error C2864: 'CefSharp::Internals::StreamAdapter::isMemoryStream' : only static const integral data members can be initialized within a class [C:\projects\cefsharp\CefSharp.Core\CefSharp.Core.vcxproj] c:\projects\cefsharp\cefsharp.core\internals\StreamAdapter.h(20): error C2864: 'CefSharp::Internals::StreamAdapter::isMemoryStream' : only static const integral data members can be initialized within a class [C:\projects\cefsharp\CefSharp.Core\CefSharp.Core.vcxproj]

@amaitland
Copy link
Member

I was thinking we do the MemoryStream check in C# and pass into the constructor, little less uglier code 😄 Thoughts?

@@ -17,6 +17,7 @@ namespace CefSharp
{
CriticalSection _syncRoot;
gcroot<Stream^> _stream;
bool isMemoryStream = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C++ we prefix with _

(I would like to make the C# code consistent, though I've had some resistance).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In next push.

@rassilon
Copy link
Contributor Author

rassilon commented Mar 3, 2015

I was thinking we do the MemoryStream check in C# and pass into the constructor, little less uglier code 😄 Thoughts?

StreamAdapter isn't called directly from C# and it's a simple C# as check anyway as it is. (via dynamic_cast<> in C++.

Bill

@amaitland amaitland added this to the 39.0.0 milestone Mar 3, 2015
@amaitland amaitland changed the title Do a little cleaning up of StreamAdapter to more effeciently deal with M... Enhance StreamAdapter to more effeciently deal with MemoryStream Mar 3, 2015
amaitland added a commit that referenced this pull request Mar 3, 2015
Enhance StreamAdapter to more effeciently deal with MemoryStream
@amaitland amaitland merged commit bba05fc into cefsharp:master Mar 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants