Skip to content

Commit

Permalink
Revert 260678 "Make http range requests by plugins also go direc..."
Browse files Browse the repository at this point in the history
Causing mac debug bot assert.

> Make http range requests by plugins also go directly to the browser process instead of going through the renderers.
> 
> BUG=286074
> R=ananta@chromium.org
> 
> Review URL: https://codereview.chromium.org/217593003

TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/220323003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260725 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed Apr 1, 2014
1 parent 5f28eb4 commit bb8558a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 69 deletions.
15 changes: 7 additions & 8 deletions content/browser/plugin_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,22 @@ bool PluginProcessHost::Init(const WebPluginInfo& info) {
// any associated values) if present in the browser command line
static const char* const kSwitchNames[] = {
switches::kDisableBreakpad,
switches::kDisableDirectNPAPIRequests,
#if defined(OS_MACOSX)
switches::kDisableCoreAnimationPlugins,
switches::kEnableSandboxLogging,
#endif
switches::kEnableStatsTable,
switches::kFullMemoryCrashReport,
#if defined(OS_WIN)
switches::kHighDPISupport,
#endif
switches::kLoggingLevel,
switches::kLogPluginMessages,
switches::kNoSandbox,
switches::kPluginStartupDialog,
switches::kTestSandbox,
switches::kTraceStartup,
switches::kUseGL,
#if defined(OS_MACOSX)
switches::kDisableCoreAnimationPlugins,
switches::kEnableSandboxLogging,
#endif
#if defined(OS_WIN)
switches::kHighDPISupport,
#endif
};

cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
Expand Down
18 changes: 4 additions & 14 deletions content/child/npapi/plugin_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "content/child/npapi/plugin_instance.h"

#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
Expand All @@ -19,7 +18,6 @@
#include "content/child/npapi/webplugin_delegate.h"
#include "content/child/npapi/webplugin_resource_client.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "net/base/escape.h"

#if defined(OS_MACOSX)
Expand Down Expand Up @@ -559,18 +557,10 @@ void PluginInstance::RequestRead(NPStream* stream, NPByteRange* range_list) {
// is called on it.
plugin_stream->set_seekable(true);

if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableDirectNPAPIRequests)) {
pending_range_requests_[++next_range_request_id_] = plugin_stream;
webplugin_->InitiateHTTPRangeRequest(
stream->url, range_info.c_str(), next_range_request_id_);
return;
} else {
PluginStreamUrl* plugin_stream_url =
static_cast<PluginStreamUrl*>(plugin_stream);
plugin_stream_url->FetchRange(range_info);
return;
}
pending_range_requests_[++next_range_request_id_] = plugin_stream;
webplugin_->InitiateHTTPRangeRequest(
stream->url, range_info.c_str(), next_range_request_id_);
return;
}
}
NOTREACHED();
Expand Down
27 changes: 5 additions & 22 deletions content/child/npapi/plugin_stream_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <algorithm>

#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "content/child/npapi/plugin_host.h"
#include "content/child/npapi/plugin_instance.h"
Expand Down Expand Up @@ -43,17 +42,6 @@ void PluginStreamUrl::URLRedirectResponse(bool allow) {
UpdateUrl(pending_redirect_url_.c_str());
}

void PluginStreamUrl::FetchRange(const std::string& range) {
PluginURLFetcher* range_fetcher = new PluginURLFetcher(
this, url_, plugin_url_fetcher_->first_party_for_cookies(), "GET", NULL,
0, plugin_url_fetcher_->referrer(), range, false, false,
plugin_url_fetcher_->origin_pid(),
plugin_url_fetcher_->render_frame_id(),
plugin_url_fetcher_->render_view_id(), id_,
plugin_url_fetcher_->copy_stream_data());
range_request_fetchers_.push_back(range_fetcher);
}

bool PluginStreamUrl::Close(NPReason reason) {
// Protect the stream against it being destroyed or the whole plugin instance
// being destroyed within the destroy stream handler.
Expand Down Expand Up @@ -83,10 +71,7 @@ void PluginStreamUrl::CancelRequest() {
for (size_t i = 0; i < range_requests_.size(); ++i)
instance()->webplugin()->CancelResource(range_requests_[i]);
}

range_requests_.clear();

STLDeleteElements(&range_request_fetchers_);
}

void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) {
Expand Down Expand Up @@ -180,8 +165,6 @@ PluginStreamUrl::~PluginStreamUrl() {
if (!plugin_url_fetcher_.get() && instance() && instance()->webplugin()) {
instance()->webplugin()->ResourceClientDeleted(AsResourceClient());
}

STLDeleteElements(&range_request_fetchers_);
}

void PluginStreamUrl::AddRangeRequestResourceId(unsigned long resource_id) {
Expand All @@ -193,11 +176,11 @@ void PluginStreamUrl::SetDeferLoading(bool value) {
// If we determined that the request had failed via the HTTP headers in the
// response then we send out a failure notification to the plugin process, as
// certain plugins don't handle HTTP failure codes correctly.
if (plugin_url_fetcher_.get()) {
if (!value && plugin_url_fetcher_->pending_failure_notification()) {
// This object may be deleted now.
DidFail(id_);
}
if (!value &&
plugin_url_fetcher_.get() &&
plugin_url_fetcher_->pending_failure_notification()) {
// This object may be deleted now.
DidFail(id_);
return;
}
if (id_ > 0)
Expand Down
7 changes: 0 additions & 7 deletions content/child/npapi/plugin_stream_url.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class PluginStreamUrl : public PluginStream,

void URLRedirectResponse(bool allow);

void FetchRange(const std::string& range);

// Stop sending the stream to the client.
// Overrides the base Close so we can cancel our fetching the URL if
// it is still loading.
Expand Down Expand Up @@ -71,14 +69,9 @@ class PluginStreamUrl : public PluginStream,

GURL url_;
unsigned long id_;

// Ids of additional resources requested via range requests issued on
// seekable streams.
// This is used when we're loading resources through the renderer, i.e. not
// using plugin_url_fetcher_.
std::vector<unsigned long> range_requests_;
// This is used when we're using plugin_url_fetcher_.
std::vector<PluginURLFetcher*> range_request_fetchers_;

// If the plugin participates in HTTP URL redirect handling then this member
// holds the url being redirected to while we wait for the plugin to make a
Expand Down
7 changes: 0 additions & 7 deletions content/child/npapi/plugin_url_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream,
const char* buf,
unsigned int len,
const GURL& referrer,
const std::string& range,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
Expand All @@ -96,9 +95,6 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream,
referrer_(referrer),
notify_redirects_(notify_redirects),
is_plugin_src_load_(is_plugin_src_load),
origin_pid_(origin_pid),
render_frame_id_(render_frame_id),
render_view_id_(render_view_id),
resource_id_(resource_id),
copy_stream_data_(copy_stream_data),
data_offset_(0),
Expand Down Expand Up @@ -137,9 +133,6 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream,
request_info.headers += "\r\n";
request_info.headers += "Content-Type: application/x-www-form-urlencoded";
}
} else {
if (!range.empty())
request_info.headers = std::string("Range: ") + range;
}

bridge_.reset(ChildThread::current()->resource_dispatcher()->CreateBridge(
Expand Down
10 changes: 0 additions & 10 deletions content/child/npapi/plugin_url_fetcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class PluginURLFetcher : public webkit_glue::ResourceLoaderBridge::Peer {
const char* buf,
unsigned int len,
const GURL& referrer,
const std::string& range,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
Expand All @@ -45,12 +44,6 @@ class PluginURLFetcher : public webkit_glue::ResourceLoaderBridge::Peer {
// Called with the plugin's reply to NPP_URLRedirectNotify.
void URLRedirectResponse(bool allow);

GURL first_party_for_cookies() { return first_party_for_cookies_; }
GURL referrer() { return referrer_; }
int origin_pid() { return origin_pid_; }
int render_frame_id() { return render_frame_id_; }
int render_view_id() { return render_view_id_; }
bool copy_stream_data() { return copy_stream_data_; }
bool pending_failure_notification() { return pending_failure_notification_; }

private:
Expand Down Expand Up @@ -81,9 +74,6 @@ class PluginURLFetcher : public webkit_glue::ResourceLoaderBridge::Peer {
GURL referrer_;
bool notify_redirects_;
bool is_plugin_src_load_;
int origin_pid_;
int render_frame_id_;
int render_view_id_;
unsigned long resource_id_;
bool copy_stream_data_;
int64 data_offset_;
Expand Down
2 changes: 1 addition & 1 deletion content/child/npapi/webplugin_delegate_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ void WebPluginDelegateImpl::FetchURL(unsigned long resource_id,
bool copy_stream_data = !!(quirks_ & PLUGIN_QUIRK_COPY_STREAM_DATA);
plugin_stream->SetPluginURLFetcher(new PluginURLFetcher(
plugin_stream, url, first_party_for_cookies, method, buf, len,
referrer, std::string(), notify_redirects, is_plugin_src_load, origin_pid,
referrer, notify_redirects, is_plugin_src_load, origin_pid,
render_frame_id, render_view_id, resource_id, copy_stream_data));
}

Expand Down

0 comments on commit bb8558a

Please sign in to comment.